标签:import ls -ld and out cut code cmd pre status
commands好像python3.6被去除了,它现在被subprocess替代了
FUNCTIONS getoutput(cmd) Return output (stdout or stderr) of executing cmd in a shell. getstatus(file) Return output of "ls -ld <file>" in a string. getstatusoutput(cmd) Return (status, output) of executing cmd in a shell.
import subprocess
(status, output) = subprocess.getstatusoutput(‘redis-cli -h 127.0.0.1 -p 6379 -n 0 keys *‘)
print (status, output)
标签:import ls -ld and out cut code cmd pre status
原文地址:https://www.cnblogs.com/BlueFire-py/p/10059980.html