How to add a string to os.system() command? (Python) -


i add tweet = "@idoodler cpu temperature " + str(cpu_temp) os.system("sudo twidge update \"tweet\"") (tweet tweet string above). can please tell me how can add tweet string os.system() command?

cmd = "sudo twidge update \"{0}\"".format(tweet) print cmd os.system(cmd) 

although honest better off using subprocess.call

import subprocess subprocess.call(["sudo","twidge","update",tweet]) 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -