a='1234;5'
print a.index('s')
the error is :
> "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
thanks
Try using
find()instead – this will tell you where it is in the string:If you just want to know whether the string is in there, you can use
in: