Jan-11-2017, 08:58 AM
You should use subrocess.check_output.
Note that this is also recommended in the docs for os.system:
Note that this is also recommended in the docs for os.system:
Quote:subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using this function. See the Replacing Older Functions with the subprocess Module section in the subprocess documentation for some helpful recipes.