>
> The amazing thing is when file_str  = 'C:\Qt\SimLCM\Default
> \Data_Input_Material.txt',
> 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.
>
>
The problem is str.find returns -1 on failure; and -1 is a true value. Only
0, empty string, empty sequences, etc, are false values.

So, you have to test, 'if find_str.find(pattern) != -1:'

HTH,

--S
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to