标签:text span 默认 pytho his hit 字符串 logs line
In [190]: "The stars are not afraid to appear like fireflies.".find("vition")#不存在返回-1 Out[190]: -1 In [192]: "The stars are not afraid to appear like fireflies.".find("a")#从左边开始查找 Out[192]: 6 In [193]: "The stars are not afraid to appear like fireflies.".rfind("a")#从右边开始查找 Out[193]: 32
In [79]: "Man is a born child, his power is the power of growth. ".count("o")#从整个字符串中统计‘o’出现的次数 Out[79]: 5 In [80]: "Man is a born child, his power is the power of growth. ".count("o",0,11)#从位置0到11统计‘o’出现的次数 Out[80]: 1
In [63]: "What you are you do not see".index("e")#默认从左边开始查找, Out[63]: 11 In [43]: "What you are you do not see".rindex("e")#从右边开始查找, Out[43]: 26 In [45]: "What you are you do not see".rindex("W",1)#从位置1开始并且从右边开始查找 结果报错 In [46]: "What you are you do not see".rindex("d",0,20))#从位置0到20中并且从右边开始查找 Out[46]: 17
标签:text span 默认 pytho his hit 字符串 logs line
原文地址:http://www.cnblogs.com/vition/p/6789241.html