Sorting Directories from files in a os.listdir??
Giampaolo Rodola'
gnewsg at gmail.com
Thu Apr 10 06:15:08 EDT 2008
On 10 Apr, 11:55, Soren <soren.skou.niel... at gmail.com> wrote:
> Hi,
>
> I'd like to read the filenames in a directory, but not the
> subdirectories, os.listdir() gives me everything... how do I separate
> the directory names from the filenames? Is there another way of doing
> this?
>
> Thanks!
I guess you have no other way than using os.path.isfile or
os.path.isdir for every entry returned by os.listdir.
--- Giampaolo
http://code.google.com/p/pyftpdlib
More information about the Python-list
mailing list