Sinisterly
CMD command using python? - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Python (https://sinister.li/Forum-Python)
+--- Thread: CMD command using python? (/Thread-CMD-command-using-python)



CMD command using python? - ImMe - 11-01-2013

If there is a way to run a CMD command using python, please tell me. I am working on a new code I MAY post on here. Thanks! :epic:


RE: CMD command using python? - Coder-san - 11-01-2013

Fixed the title.


RE: CMD command using python? - Coder-san - 11-01-2013

Fixed the title.


RE: CMD command using python? - Deque - 11-02-2013

example:

Code:
from subprocess import call call(["cowsay", "-f", random_cow, "Hello World"])



RE: CMD command using python? - Deque - 11-02-2013

example:

Code:
from subprocess import call call(["cowsay", "-f", random_cow, "Hello World"])



RE: CMD command using python? - Anima Templi - 11-02-2013

Damn you @Deque I was just about to post something similar to that.


RE: CMD command using python? - Crime - 11-04-2013

Yes, on Windows you can;

Code:
import os os.system()

Google for arguments and other functions.


RE: CMD command using python? - hunt3r972 - 12-19-2013

Quote:import os

os.system("your command")

or

Quote:import os

var=os.poppen("your command").read()
var=var.replace('\n','') #delete the line jumping
print var

or

Quote:use subprocess