0

I like to add tweet = "@idoodler My CPU temperature is " + str(CPU_temp) to os.system("sudo twidge update \"tweet\"") (tweet is the tweet string above). Can anyone please tell me how I can add the tweet string to the os.system() command?

1 Answer 1

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

although to be honest you are probably better off using subprocess.call

import subprocess
subprocess.call(["sudo","twidge","update",tweet])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.