我想将tweet = "@idoodler My CPU temperature is " + str(CPU_temp)
添加到os.system("sudo twidge update \"tweet\"")
(推文是上面的推文字符串)。谁能告诉我如何将tweet字符串添加到os.system()命令?
答案 0 :(得分:1)
cmd = "sudo twidge update \"{0}\"".format(tweet)
print cmd
os.system(cmd)
虽然老实说你最好不要使用subprocess.call
import subprocess
subprocess.call(["sudo","twidge","update",tweet])