find查找、split分隔、replace替换

1 #!/usr/bin/env python
2 r = "asada"
3 ret = r.find("d")
4 print(ret)#返回所在位置的索引
5 ret =r.split("d")
6 print(ret)#分隔
7 ret = r.replace("sa","k")
8 print(ret)#替换

结果C:\Python35\python3.exe F:/Python/笔记1/a1.py
3
['asa', 'a']
akda


Process finished with exit code 0

 

 

posted @ 2017-02-13 18:31  失落的黎明  阅读(409)  评论(0编辑  收藏  举报