首页 > 其他 > 详细

find查找、split分隔、replace替换

时间:2017-02-13 20:15:49      阅读:219      评论:0      收藏:0      [点我收藏+]
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

 

 

find查找、split分隔、replace替换

原文:http://www.cnblogs.com/shiluoliming/p/6394985.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!