0
Confused about the triple quotes?
How exactly would you execute it? B/c im doing it wrong. print(""" """) ? and hit enter when im ready for a new line? thx
5 Answers
+ 4
You can escape characters like a quote with the \ character.
\" is to escape a quote.
A quotation inside of two quotes would look like this : "\"" .
So your code would look like this:
print("\"\"\"\"")
+ 4
The triple quotes are for strings like this:
my_string = ''''this is a string that
spans multiple lines
I just pressed enter to enter the new lines
like this'''
print(my_string) # this will print the string with the '\n' added
EDITED
It doen't look soo but I'm using triple quotes in the example.
+ 2
Did not understand what you are trying to do?
+ 1
Ok, i misunderstood. Thx for clearing it up fellas!
Edit: Also, is there a way to reply besides "answering" or "editing" my own question?
0
I understand how the "\n" works, but the lesson mentions not having to do it manually when using triple quotes. Im having trouble executing it.
If i type
print("""What time is it? #Enter """) It closes out before i get to the second line. Thx