Invoking DOS command via python script

mekalai

Recruit
Hi,

I would like to know if it is possible to invoke a DOS command via a python script. If possible, what is the module which supports this?

Thanks!
 
a simple google search will throw up the solution for you. Its better if you use it first before opening a thread.

module is os.
 
Yes, you need to import the OS module.

Code:
 python

Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32) 

Type "help", "copyright", "credits" or "license" for more information.

>>> import os

>>> os.system("DOS COMMAND HERE")

System function returns 0 on success and garbage on fail. Outputs automatically to stdout.
 
Back
Top