I came across this:
>>> import os
>>> os.system('ls')
file.txt README
0
What is return value of os.system()? Why I get 0?
I came across this:
>>> import os
>>> os.system('ls')
file.txt README
0
What is return value of os.system()? Why I get 0?
You might want to use
return_value = os.popen('ls').read()
instead. os.system only returns the error value.
The os.popen is a neater wrapper for subprocess.Popen function as is seen within the python source code.