3 ms·
"""-delimited text is not actually a comment. Its a multiline string literal x = """aaa bbb""" And you can also use single quotes if you want. x
by ufo 13y ago
"""-delimited text is not actually a comment. Its a multiline string literal
x = """aaa
bbb"""
And you can also use single quotes if you want.
x = '''aaa'''
The reason this might have been confused with a comment is because triple-quoted strings are often used for documentation strings, a Python feature that gives special meaning to string literals that occur as the first statement in a function or class. Those strings get associated to the function as its documentation and can even be inspected at runtime:
def foo():
"my documentation string"
return 17
print help(foo)