[Tutor] Issuing Linux commands
alan.gauld@bt.com
alan.gauld@bt.com
Thu, 22 Aug 2002 16:28:09 +0100
> Is there a way to issue Linux commands -- ls, mkdir, mv, cp, mc, ...,
> from within python?
You can use the os.system() call or the popen() functions or
the commands module. All of these execute the command as a
separate process.
However things like mkdir, mv, cp etc are often better done within
a script using Python equivalent commands.
(Better => faster, less memory etc)
See the documentation for:
glob
os
os.path
for many common commands that exist as Python functions.
Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld