试试这个:
import subprocess# cmd contains shell commandcmd="your command shell"process = subprocess.Popen(cmd,shell=True,stdin=None,stdout=subprocess.PIPE,stderr=subprocess.PIPE)# The output from your shell commandresult=process.stdout.readlines()if len(result) >= 1: for line in result: print(line.depre("utf-8"))


