Skip to main content

Python Symbols Reference

Python uses several symbols to organize code and handle data structures. This is a quick reference for those who are used to other languages like C.

Common Symbols

SymbolNameUsage in Python
( )ParenthesesUsed for function calls, tuples, and expression grouping.
{ }Curly BracketsUsed to define dictionaries and sets.
[ ]Square BracketsUsed to define lists and for indexing/slicing.
#Hash/PoundStarts a single-line comment.
:ColonStarts an indented code block (like in if, for, or def).
|PipeUsed for dictionary merging (Python 3.9+) or bitwise OR.

Symbol Grouping

Python relies heavily on whitespace and indentation rather than curly brackets for controlling the flow of code. This is one of the biggest changes coming from languages like C.