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
时间: 2024-10-25 08:03:47