Professional Documents
Culture Documents
3.1 Multi-Line Statements and Strings PDF
3.1 Multi-Line Statements and Strings PDF
tuple literals: ( )
dictionary literals: { }
def my_func(a,
set literals: { } b, #comment
c):
function arguments / parameters print(a, b, c)
my_func(10, #comment
supports inline comments
20, 30)
Explicit
You can break up statements over multiple lines explicitly, by using the \ (backslash ) character
if a if a \
and b and b \
and c: and c:
if a \
and b \ #comment
and c:
Multi-Line String Literals
Multi-line string literals can be created using triple delimiters (' single or " double)
'''This is """This is
a multi-line string''' a multi-line string"""
You can use escaped characters (e.g. \n, \t), use string formatting, etc.
Multi-line strings are not comments, although they can be used as such,
especially with special comments called docstrings.