Shell command
Gerhard Häring
gh_pythonlist at gmx.de
Tue Feb 12 04:52:09 EST 2002
Le 12/02/02 à 04:45, William Park écrivit:
> On Tue, Feb 12, 2002 at 10:35:21AM +0100, DelPiccolo Ivano wrote:
> > How can I do to launch a command in my python script ?
> > example : I want to launch the command : rm test.txt
>
> os.system('rm test.txt')
Yep. But instead of most of that "simple" shell commands you can use
Python functions in the os and shutil modules, for example:
os.unlink("test.txt") # Remove the file
This is a little bit faster then executing a seperate shell process, and
looking into these modules is quite informative :-)
Gerhard
--
This sig powered by Python!
Außentemperatur in München: 11.7 °C Wind: 7.9 m/s
More information about the Python-list
mailing list