python 字符串操作
来源:互联网 发布:淘宝官网招聘 编辑:程序博客网 时间:2024/06/05 14:30
(一)字符串操作
(二)字符串索引与分片
- >>> str = 'abcdefg'
- >>> str[2]
- 'c'
- >>> str[-2] #倒数第二个字符
- 'f'
- >>> str[-0]
- 'a'
- >>> str[1:4]
- 'bcd'
- >>> str[1:1]#不包含第2个字符,故为空
- ''
- >>> str[1:-1]#从第二个字符到最后一个字符,但不包含最后一个字符
- 'bcdef'
- >>> str[0:-2]#从第一个字符到倒数第二个字符(不包含)
- 'abcde'
- >>> str[:2] #与str[0:2]相同
- 'ab'
- >>> str[:-2] #与str[0:-2]相同
- 'abcde'
- >>> str[1:]
- 'bcdefg'
- Python字符串操作
- Python字符串操作
- Python字符串操作
- python 字符串操作
- python字符串操作
- Python字符串操作
- Python字符串操作[转]
- Python字符串操作
- Python字符串操作
- Python学习---字符串操作
- python 中的字符串操作
- python------字符串连接操作
- python字符串操作
- python 字符串操作
- Python字符串操作
- python字符串操作
- Python字符串操作
- python 中的字符串操作
- 如何在retina显示屏中截屏适应你的VIew
- tudou,youku m3u8文件抓取地址
- [程序猿感悟] 送给和我一样曾经浮躁过的PHP程序猿
- C++中两个数的交换
- 如何降低android应用程序的耗电量
- python 字符串操作
- python日期操作
- teradata中的部分sql命令
- python 数据类型:列表和元组
- HSRP实验总结兼分析
- bison和flex的基本原理
- 禁止某几个文件用ARC模式编译
- Vim 修改注释的颜色
- android显示通知栏