import subprocess def cmd(command): subp = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8") return subp.communicate() res = cmd("ls -l") res = res[0] res = res.split("\n") for line in res: print(line)
搜索
复制