RosettaCodeData/Task/Execute-a-system-command/Python/execute-a-system-command-1.py

4 lines
183 B
Python
Raw Permalink Normal View History

2013-04-10 16:57:12 -07:00
import os
exit_code = os.system('ls') # Just execute the command, return a success/fail code
output = os.popen('ls').read() # If you want to get the output data. Deprecated.