How to separate directory list and file list?

George Sakkis gsakkis at rutgers.edu
Sun Oct 23 12:31:00 EDT 2005


"Gonnasi" <harddong at 21cn.net> 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?
>
> Tons of thanks in advance!
>
> Gonnasi

Using the path module (http://www.jorendorff.com/articles/python/path/):

from path import path
path('.').files()

George





More information about the Python-list mailing list