+ 2

I'm confused about the triple quotations making \n in the output. What is it for?

17th Apr 2017, 3:57 PM
Jonathan Kressbach
3 Antworten
+ 6
Triple quotes are mostly used as multiline comments, although it's not their real application. Those are string literals, meaning they store a string inside it *exactly* how it is written - kind of a Python replica of the HTML <pre></pre> tag. Check it out - without those triples I would have to count the spaces and lines and try to fit those string adequately line after line: https://code.sololearn.com/cwjsOELw9656/?ref=app
17th Apr 2017, 5:19 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 9
triple quotations themselves are showing comment myVar = 1 '''This is a 1st line of comment myVar = 42''' print (myVar) would print 1
17th Apr 2017, 4:00 PM
Dinmukhamed Mailibay
Dinmukhamed Mailibay - avatar
0
''' stands for a multi line comment Example: ''' This is a Multi line comment '''
19th Apr 2017, 1:28 PM
Alex Dammann