I'm trying to run Zenity in a python script, to display a variable.
nmaj = 10
cmd = ["zenity" "--question" "--text='Are you " + str(nmaj) + "years old ?'"]
subprocess.call(cmd, shell=True)
Can I put a string in the command? How? Thanks
You can try using format
and putting ''
outer than ""
:
nmaj = 10
cmd = 'zenity --question --text="Are you {} years old ?"'.format(nmaj)
subprocess.call(cmd, shell=True)