When you create a string, Python lets you to use either a pair of single quotes or a pair of double quotes. Both mean "a string is inside." This example shows a double-quoted string and a single-quoted string:
>>> penguin = "on top of the television set" >>> what it is doing =
If your text includes single quotation marks or apostrophes, it's easiest to make it into a string by surrounding it with double quotes, like this:
>>> knights = "We are the Knights Who Say >>> print knights
We are the Knights Who Say 'Ni'!
Likewise, if your text includes double quotes, it's easiest to make a string by surrounding it with single ones.
Was this article helpful?
Post a comment