When calling a command from python os.system(cmd) I was using, but I was looking for a way to use the results.
subprocess.check_output(cmd)
Note that when you add an argument to a command, you need to pass it as a list. You may want to create a command separated by a space and call it like this.
subprocess.check_output(cmd.split()).split('\n')
reference: http://www.lifewithpython.com/2013/11/python-using-terminal-commands.html http://takuya-1st.hatenablog.jp/entry/2014/08/23/022031
Recommended Posts