I am trying to do a simple sub string matching in Python and although I remember last night it was working fine, but since morning this piece of code is giving the following error. It seems to be a known error, can anyone suggest why is it happening?
if string.find(row[1],drug) != -1:
print "abstract id = ", row[0],"Drug found=", drug
error :
File "./substring.py", line 31, in <module>
if string.find(row[1],drug) != -1:
TypeError: slice indices must be integers or None or have an __index__ method
Here row[1] and drug both are simple strings.
Instead of
string.find(row[1], drug), tryrow[1].find(drug). The.find()method will give you the index of the first occurrence of the string.