I have a very beginner question. I'm trying to do the following where I need to get a list from another Python script using subprocess
.
level 1 :
#!/usr/bin/python
import sys
import os
def run(a):
print "running"
return a
#if __name__ == "__main__":
run(str(sys.argv[1]))
level 0 :
import sys
import os
import subprocess
output = subprocess.check_output(['python','level1.py','test'])
print output
However, when I run this, the output prints out "running" instead of the value stored in variable a
.
I was wondering how I can get the value of a instead of all the print
statements.