file find skips first letter

Tim Chase python.list at tim.thechases.com
Tue Feb 15 13:59:59 EST 2011


On 02/15/2011 12:32 PM, Wanderer wrote:
>              if f.find(fileBase)>  0:

.find() returns "-1" on failure, not 0.  You want ">=" instead of 
just ">", or even more readably

   if fileBase in f:

-tkc







More information about the Python-list mailing list