在Python中 基本数据类型有 str int boolean list dict tuple等 其中str的相关方法有30多个 但是常用的就以下7个

join 
# split
# find
# strip
# upper
# lower
# replace

除了以上7个常用方法外,还有个五基本方法务必牢记 在以后会经常用到

一、for循环
# for 变量名 in 字符串:
# 变量名
# break
# continue

# index = 0
# while index < len(test):
# v = test[index]
# print(v)
#
# index += 1
# print('=======')

# for zjw in test:
# print(zjw)

# test = "让技术成为你的核心竞争力"
# for item in test:
# print(item)
# break

# for item in test:
# continue
# print(item)

# 二、索引,下标,获取字符串中的某一个字符
# v = test[3]
# print(v)

# 三、切片
# v = test[0:-1] # 0=< <1
# print(v)

# 四、获取长度
# Python3: len获取当前字符串中由几个字符组成
# v = len(test)
# print(v)

# 五、获取连续或不连续的数字,
# Python2中直接创建在内容中
# python3中只有for循环时,才一个一个创建
# r1 = range(10)
# r2 = range(1,10)
# r3 = range(1,10,2)
# 帮助创建连续的数字,通过设置步长来指定不连续
# v = range(0, 100, 5)
#
# for item in v:
# print(item)

最新文章

  1. Server.Transfer 和 Response.Redirect 用法区别
  2. appach2.4 + php7 +mysql5.7.14 配置
  3. sharePoint 2016 弃用和删除的功能
  4. 友盟SDK实现分享
  5. 两个list取不同值
  6. sql语句与 数据库
  7. qq临时会话设置
  8. 【USACO】Milking Cows
  9. A Tour of Go Exercise: Images
  10. 【转】MSSQL获取指定表的列名信息,描述,数据类型,长度
  11. 解决GDB输出Qt内置类型的显示问题
  12. SQL Server2005使用CTE实现递归
  13. Swift - .plist文件数据的读取和存储
  14. 【Linux探索之旅】第一部分第三课:测试并安装Ubuntu
  15. JSP精华知识点总结
  16. Android Studio 3.0+ Annotation processors must be explicitly declared now
  17. webpack-dev-server的执行逻辑
  18. MyBatis项目快速搭建及MySQL一个Statement支持多条命令参数
  19. html5获取地理位置信息API
  20. tomcat重启步骤

热门文章

  1. Python Indentation
  2. CH5702 Count The Repetitions[倍增dp]
  3. redis设置为null问题
  4. pair对组
  5. Win7服务器搭建实例教程:教你Win7如何搭建Web服务器【转载】
  6. CF 19E Fairy——树上差分
  7. Python 函数之递归
  8. 0. LeetCode 开篇
  9. 聊聊WPF中的Dispatcher
  10. Android高仿京东淘宝自动无限循环轮播控件的实现思路和过程