Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
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.
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import subprocess
|
||||
# if the exit code was non-zero these commands raise a CalledProcessError
|
||||
exit_code = subprocess.check_call(['ls', '-l']) # Python 2.5+
|
||||
assert exit_code == 0
|
||||
output = subprocess.check_output(['ls', '-l']) # Python 2.7+
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
from subprocess import PIPE, Popen, STDOUT
|
||||
p = Popen('ls', stdout=PIPE, stderr=STDOUT)
|
||||
print p.communicate()[0]
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
import commands
|
||||
stat, out = commands.getstatusoutput('ls')
|
||||
if not stat:
|
||||
print out
|
||||
Loading…
Add table
Add a link
Reference in a new issue