1、返回第一個出現的索引
>>> test1 'absacaxy'
>>> test1.find("a") 0
2、返回特定字符的所有索引
>>> test1 'absacaxy'
>>> b = test1.count("a") >>> c = -1
>>> for i in range(b): c = test1.find("a",c + 1,len(test1)) print(c) 0
3
5
1、返回第一個出現的索引
>>> test1 'absacaxy'
>>> test1.find("a") 0
2、返回特定字符的所有索引
>>> test1 'absacaxy'
>>> b = test1.count("a") >>> c = -1
>>> for i in range(b): c = test1.find("a",c + 1,len(test1)) print(c) 0
3
5
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。