Hi,

2005/10/23, Gonnasi <[EMAIL PROTECTED]>:
> 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?
don't know if it is the best solution, but it looks nice. :)

path = "/home/test"
files = [fn for fn in os.listdir(path) if
os.path.isfile(os.path.join(path, fn))]

This gives you just the list of files in a given directory.

Best regards,
Oliver



--
Oliver Andrich <[EMAIL PROTECTED]> --- http://roughbook.de/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to