output from external commands
kent37 at tds.net
Mon Oct 24 13:53:12 CEST 2005
darren kirby wrote:
> quoth the James Colannino:
>>So, for example, in Perl I could do something like:
>>@files = `ls`;
>>So I guess I'm looking for something similiar to the backticks in Perl.
>>Forgive me if I've asked something that's a bit basic for this list.
>>Any help would be greatly appreciated :) Thanks very much in advance.
> If all you want is filenames this will work:
>>>>files = ["%s" % f for f in glob.glob("*")]
files = os.listdir('.')
Python has built-in support for many file manipulations, see the os, os.path and shutil modules.
More information about the Python-list