小册名称:Python合辑4-130个字符串操作示例
如何在 Python 字符串中找到第一次出现的子字符串
test = 'Position of a character'print(test.find('of'))print(test.find('a'))
test = 'Position of a character'
print(test.find('of'))
print(test.find('a'))
Output:
912
9
12