How to run shell commands within python
Donn Cave
donn at u.washington.edu
Thu Feb 16 13:05:36 EST 2006
In article <mailman.1993.1140077329.27775.python-list at python.org>,
"Fredrik Lundh" <fredrik at pythonware.com> wrote:
> (also note that most trivial shell commands are better done in
> python. most uses of cat, for example, can be trivially emulated
> with one or two lines of python...)
Though the knowledge required to do this may be more trivial
for some of us than others! "cat" probably doesn't have much
going for it that a naive implementation would miss - some
versions will recreate "holes", but most applications will never
miss this. You can replace "mv" with os.rename() if you don't
care that it will fail when the destination is on a different
filesystem. Etc.
Donn Cave, donn at u.washington.edu
More information about the Python-list
mailing list