Skip to main content

03 | Working with apostrophes

If your string includes an apostrophe, then use double quotes to define the string.

apostrophe.py

print("Don't fear!")
print("I'm here!")

You can use an apostrophe within a string enclosed with single quotes if you escape the apostrophe:

print('Don\'t fear!') # This isn't a problem. 

Error example: The apostrophe below creates problems if not escaped. Notice the color syntax only highlights up until the first single quote.

print('Don't fear!') # This does't work and even screws up the inline comment.