"Gonnasi" wrote:
> With
> >glob.glob("*")
>
> or
> >os.listdir(cwd)
>
> I can get a combined file list with directory list, but I just wanna a
> bare file list, no directory list. How to get it?
use os.path.isfile on the result.
for file in glob.glob("*"):
if not os.path.isfile(file):
continue
... deal with file ...
for file in os.listdir(cwd):
file = os.path.join(cwd, file)
if not os.path.isfile(file):
continue
... deal with file ...
files = map(os.path.isfile, glob.glob("*"))
files = (file for file in os.listdir(cwd) if
os.path.isfile(os.path.join(cwd, file)))
etc.
</F>
--
http://mail.python.org/mailman/listinfo/python-list