Besides numbers, Python can also manipulate strings, which can be expressed in several ways. They can be enclosed in single quotes ($_{'...'}$ ) or double quotes ($_{"..."}$ ) with the same result$^{2}$. \ can be used to escape quotes: >>> 'spam eggs' # single quotes 'spam eggs' >>> 'doesn \' t' # use \' to escape the single quote... "doesn't" >>> "doesn't" # ...or use double quotes instead "doesn't" >>> '"Yes,"they said.' '"Yes," they said.' >>> " " Yes, " they said." '"Yes," they said.' >>> '"Isn \' t,"they said.' '"Isn\'t," they said.' In the interactive interpreter, the output string is enclosed in quotes and special characters are escaped with back- slashes. While this might sometimes look different from the input (the enclosing quotes could change), the two strings are equivalent. The string is enclosed in double quotes if the string contains a single quote and no double quotes, otherwise it is enclosed in single quotes. The print() function produces a more readable output, by omitting the enclosing quotes and by printing escaped and special characters: Python Tutorial, Release 3.9.5 3.1.2 Strings >>> '"Isn \' t,"they said.' '"Isn\'t," they said.' >>> print('"Isn \' t,"they said.') "Isn't," they said. >>> s ='First line. Second line.' # 
 means newline >>> s # without print(), 
 is included in the output 'First line.
Second line.' >>> print(s) # with print(), 
 produces a new line First line. Second line. >>> print('C:\some ame') # here 
 means newline! C:\some ame >>> print(r'C:\some
ame') # note the r before the quote C:\some
ame Usage: thingy [OPTIONS] -h Display this usage message -H hostname Hostname to connect to 2 Unlike other languages, special characters such as have the same meaning with both single ( '...' ) and double ( "..." ) quotes. The only difference between the two is that within single quotes you don’t need to escape " (but you have to escape \' ) and vice versa. String literals can span multiple lines. One way is using triple-quotes: """...""" or$_{'''...'''}$ . End of lines are automatically included in the string, but it’s possible to prevent this by adding a$_{\}$ at the end of the line. The following example: produces the following output (note that the initial newline is not included): print(""" \ Usage: thingy [OPTIONS] -h Display this usage message -H hostname Hostname to connect to """ ) 11 3.1. Using Python as a Calculator If you don’t want characters prefaced by$_{\}$ to be interpreted as special characters, you can use raw strings by adding an$_{r}$ before the first quote: