Single-Quoted Strings and Escaping Quotes :
Strings are values, just as numbers are:
'Hello, world!'
There is one thing that may be a bit surprising about this example, though:
When Python printed out our string, it used single quotes, whereas we used double quotes.
What’s the difference? Actually, there is no difference:
'Hello, world!'
Here, we use single quotes, and the result is the same. So why allow both?
Because in some cases it may be useful:
"Let's go!"
>>> '"Hello, world!" she said'
No comments:
Post a Comment