How to hide output of subprocess in Python 2.7

前端 未结 5 1239
无人及你
无人及你 2020-11-22 01:14

I\'m using eSpeak on Ubuntu and have a Python 2.7 script that prints and speaks a message:

import subprocess
text = \'Hello World.\'
print text
subprocess.ca         


        
5条回答
  •  不知归路
    2020-11-22 01:49

    Why not use commands.getoutput() instead?

    import commands
    
    text = "Mario Balotelli" 
    output = 'espeak "%s"' % text
    print text
    a = commands.getoutput(output)
    

提交回复
热议问题