a='1234;5'
print a.index('s')
的錯誤是:如何找到一個字符串是否包含在另一個字符串
> "D:\Python25\pythonw.exe" "D:\zjm_code\kml\a.py"
Traceback (most recent call last):
File "D:\zjm_code\kml\a.py", line 4, in <module>
print a.index('s')
ValueError: substring not found
感謝
這是另外一個問題重複:http://stackoverflow.com/questions/3437059/does-python-have-a-string-contains-方法 – 2013-07-05 19:08:56
在另一個字符串中的字符串?你說的。這是python – joaquin 2013-09-05 15:48:18
@安德森:同意,它應該被重複關閉。 – lpapp 2013-09-05 18:47:36