find-Method 有一个start-argument:
text = "John got up. John went to the cinema. John washed his hand."
pos = -1
while True:
pos = text.find('John', pos + 1)
if pos == -1:
break
do_something
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9186 次 |
| 最近记录: |