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
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:
> 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
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
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(