On Sep 3, 1:10 am, Helvin <helvin...@gmail.com> wrote: > if file_str.find('Geometry'): > #if file_str.endswith('Data_Input_Geometry.txt'): > print 'I found geometry' > 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'. > > Does anyone know why this is happening?
Yep. You should read the documentation on the find method. It returns -1 when the substring is not found. Also, if 'Geometry' had been found at the beginning, it would have returned 0. John -- http://mail.python.org/mailman/listinfo/python-list