How do you conver output of "popen('ls')" to a list?
nas at python.ca
Thu Feb 21 02:00:18 CET 2002
> 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.
Sorry, that's still not a good argument for two forks and god knows how
any system calls. Try this:
txt_files = glob.glob("*txt")
More information about the Python-list