Reputation: 9559
Editing to make question short and precise.
y = 7
command_to_send = 'command=\\\\\\"set value {0}\\\\\\\"'.format(y)
How can I get output of command_to_send
as command=\\\"set value 7\\\"
so that I can pass command_to_send
to some other function.
Upvotes: 1
Views: 235
Reputation: 1116
command = '\\\\\\"set value 0\\\\\\\"'
print("command={0}".format(command))
Produces output:
command=\\\"set value 0\\\"
If you want to assign you value from a variable, then you can do this:
y = 7
command_to_send = 'command=\\\\\\"set value {0}\\\\\\\"'.format(y)
print(command_to_send)
Upvotes: 0
Reputation: 6359
Using a raw string:
command = r"\\\"
Using a regular string:
command = "\\\\\\"
Upvotes: 3