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)

 

相关文章:

  • 2021-05-23
  • 2021-05-29
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
猜你喜欢
  • 2021-12-04
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2021-06-13
  • 2021-07-28
相关资源
相似解决方案