If you want to stick with using os.system
to make your calls, you can just format the command you pass to it:
import os
phone_number = raw_input("Number?")
os.system("yowsup-cli demos --login PHONE:PASSWORD= --send '{0}' 'MESSAGE'".format(phone_number))
However, chepner brings up a good point in his answer. You should really be using the subprocess
module for things like this, as it is a much more flexible tool. To get the same behavior using subprocess
, just pass a list to subprocess.call
with the elements being all the space separated segments of your call:
import subprocess
phone_number = raw_input("Number?")
subprocess.call(["yowsup-cli", "demos", "--login" "PHONE:PASSWORD=", "--send", phone_number, "MESSAGE"])
You can check out more on subprocess
here.