码迷,mamicode.com
首页 > 编程语言 > 详细

python查找字符串 函数find() 用法

时间:2018-09-22 14:42:34      阅读:378      评论:0      收藏:0      [点我收藏+]

标签:ted   字段   print   str1   tty   bcd   查找   意思   span   

sStr1 = ‘abcdefg‘
sStr2 = ‘cde‘
print sStr1.find(sStr2)

输出 2
意思是在sStr1字符里的第2位置找到了包含cde字符的字段

python查找字符串 函数find() 用法

标签:ted   字段   print   str1   tty   bcd   查找   意思   span   

原文地址:https://www.cnblogs.com/kaibindirver/p/9689805.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!