标签: python bash subprocess
我只是试图通过子进程从python中捕获history命令的输出......并且它不起作用:
history
import shlex, subprocess, time, os, sys from subprocess import Popen, PIPE command_line = "history" args = shlex.split(command_line) p = subprocess.Popen(args, stdout=PIPE, stderr=PIPE)