I thought the Triple quotation marks made a comment instead of a string...can someone clarify? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

I thought the Triple quotation marks made a comment instead of a string...can someone clarify?

17th Mar 2017, 10:09 AM
Jordan Kirkland
Jordan Kirkland - avatar
2 ответов
+ 1
Python doesn't use triple quotations for comments, if you wanna comment your code, you have to use pound (#) sign. Sometimes you have to use double quotations in your string, that way in order to tell the Python interpreter that these quotations are part of the string, you may use single or triple quotations. It's just a convention, but one advantage that triple quotations have, is that by using them, you can write multi-line strings.
17th Mar 2017, 10:45 AM
Mohammad Hossein Shahin
Mohammad Hossein Shahin - avatar
0
python uses triple ''' for multi line comments. #This is a python comment ''' This is also a Python comment '''
17th Mar 2017, 10:53 AM
LordHill
LordHill - avatar