How do you conver output of "popen('ls')" to a list?

husam husam at macrozon.net
Wed Feb 20 07:09:26 EST 2002


Neil Schemenauer wrote:

> I'm a bit late coming in on this thread but what's wrong with:
>
>     os.listdir('.')
>
> It's more portable and faster.
>
>   Neil

os.listdir('.') gets you all the files in the '.' dircetory. This want
work if i want to process some selected files. In contrast to this,
"os.popen() allows you to pass arguments like "ls *txt" to retrieve only
*.txt files.




More information about the Python-list mailing list