In Python, multiline comments are typically created using triple quotes ('''
or """
). These quotes allow you to span comments across multiple lines without needing a hash symbol (#
) at the start of each line. While these are technically string literals that are not assigned to a variable, they are treated as comments when not used in any expressions. Here’s an example:
Alternatively, for documentation purposes, Python uses triple quotes for docstrings, which can also act as comments if not used.