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:Python35python3.exe F:/Python/笔记1/a1.py
3
['asa', 'a']
akda
Process finished with exit code 0