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

22nd May 2017, 6:32 PM
Ben
Ben - avatar
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("\"\"\"\"")
22nd May 2017, 6:59 PM
Tim G
Tim G - avatar
+ 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.
22nd May 2017, 7:00 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 2
Did not understand what you are trying to do?
22nd May 2017, 6:52 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 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?
22nd May 2017, 7:12 PM
Ben
Ben - avatar
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
22nd May 2017, 6:56 PM
Ben
Ben - avatar