string find mystery
helvinlui at gmail.com
Thu Sep 3 07:10:37 CEST 2009
I have come across this very strange behaviour. Check this code:
print 'I found geometry'
print 'I found material'
The amazing thing is when file_str = 'C:\Qt\SimLCM\Default
the first if statement if fulfilled, that seemingly says that in this
file_str, python actually finds the word 'Geometry'.
I know this, because the line: 'I found geometry' is printed. However,
if instead of using file_str.find(), I use file_str.endswith(), it
does not exhibit this strange behaviour.
Obviously, I want the elif line to be true, instead of the first if
Does anyone know why this is happening?
Help much appreciated!
More information about the Python-list