I have a string
‘”No, thanks, Mom,” I said, “I don’t know how long it will take.”‘
I assign it to a variable foobar
>>> foobar = """'"No, thanks, Mom," I said, "I don't know how long it will take."'"""
But when I print I get
>>> foobar
'\'"No, thanks, Mom," I said, "I don\'t know how long it will take."\''
>>>
How can I exactly print the same value of the string as I have assigned it?
To print a string, use …
print:If you just enter
foobar, Python prints the representation of foobar. The representation is designed to be valid Python code and/or useful for debugging, and is not meant to be outputted to users.