isfile . is dir
Rene Pijlman
reageer.in at de.nieuwsgroep
Wed Feb 19 15:01:00 EST 2003
kay c:
>I'm testing wether or not files in listdir() are files or dirs.
>What am I doing that all jar files are not recognized as files?
>
>for x in os.listdir(SRCDIR +'/jar'):
> if os.path.isfile(x):
x is only the filename, not the full path. If the current
working directory is not SRCDIR/jar, this will not work as
expected.
Try this (not tested):
for x in os.listdir(SRCDIR +'/jar'):
if os.path.isfile(os.path.join(SRCDIR + '/jar',x)):
--
René Pijlman
Wat wil jij leren? http://www.leren.nl
More information about the Python-list
mailing list