Re: file find skips first letter

2011-02-15 Thread Tim Chase
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 -- http://mail.python.org/mailman/listinfo/python-list

Re: file find skips first letter

2011-02-15 Thread MRAB
On 15/02/2011 18:48, Mel wrote: Wanderer wrote: I'm using code def getFiles(self, fileBase): """return a list of the filenames in a director containing a base word """ allFiles = os.listdir(self.resultDir) baseFiles = [] for f in allFiles:

Re: file find skips first letter

2011-02-15 Thread Miki Tebeka
> def getFiles(self, fileBase): > """return a list of the filenames in a director containing a > base word > """ > ... Have a look at the glob module, it does what you want. HTH -- Miki Tebeka http://pythonwise.blogspot.com -- http://mail.python.org/mailman/listinfo/python-li

Re: file find skips first letter

2011-02-15 Thread Alexander Kapps
On 15.02.2011 19:32, Wanderer wrote: I'm using code def getFiles(self, fileBase): """return a list of the filenames in a director containing a base word """ allFiles = os.listdir(self.resultDir) baseFiles = [] for f in allFiles: if

Re: file find skips first letter

2011-02-15 Thread Mel
Wanderer wrote: > I'm using code > > def getFiles(self, fileBase): > """return a list of the filenames in a director containing a > base word > """ > > allFiles = os.listdir(self.resultDir) > baseFiles = [] > for f in allFiles: > if f.find(