import subprocess
output =Popen(["mycmd","myarg"], stdout=PIPE).communicate()[0]


import subprocess
p = subprocess.Popen(['ls','-a'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
print out

 

# work on Unix/Linux only

import commands
print commands.getstatusoutput('wc -l file')[1]

相关文章:

  • 2021-09-02
  • 2022-12-23
  • 2021-11-26
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2021-08-09
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案