I want to output
XYZ's "ABC"
I tried the following 3 statements in Python IDLE.
- 1st and 2nd statement output a
\before'. - 3rd statement with print function doesn't output
\before'.
Being new to Python, I wanted to understand why \ is output before ' in the 1st and 2nd statements.
>>> "XYZ\'s \"ABC\""
'XYZ\'s "ABC"'
>>> "XYZ's \"ABC\""
'XYZ\'s "ABC"'
>>> print("XYZ\'s \"ABC\"")
XYZ's "ABC"