[Tutor] if item.find(extension)!= -1: -- what's the -1?

David ldl08 at gmx.net
Sat Feb 6 17:35:07 CET 2010


Hello again,

in Knowlton's 2008 book "Python: Create, Modify, Reuse" the author makes 
frequent use of the term -1 in his code, but doesn't tell to what aim. 
For want of search terms Google is not helpful. Could someone please 
enlighten me by means of a one-liner as a reply?

Thank you!

David


Example Code:

for item in filelist:
         if item.find(extension)!= -1:
             snaplist.append(item)


More information about the Tutor mailing list