code
ref
Cheat Sheets
Quick Reference
JSON Formatter
Learn
Tools
Browser Support
Search…
Ctrl K
Cheat Sheets
/
Languages
/
Python
Python
Built-in functions, core types and common standard library modules.
Official reference ↗
Built-in Functions
Common
print()
input()
len()
range()
enumerate()
zip()
map()
filter()
sorted()
reversed()
sum()
min()
max()
abs()
round()
any()
all()
Types
int()
float()
str()
bool()
list()
dict()
set()
tuple()
type()
isinstance()
Objects
getattr()
setattr()
hasattr()
dir()
id()
vars()
open()
list
append()
extend()
insert()
remove()
pop()
clear()
index()
count()
sort()
reverse()
copy()
str
capitalize()
count()
endswith()
find()
format()
join()
lower()
upper()
replace()
split()
splitlines()
startswith()
strip()
lstrip()
rstrip()
title()
zfill()
dict
get()
items()
keys()
values()
pop()
popitem()
setdefault()
update()
clear()
copy()
fromkeys()
set
add()
discard()
remove()
union()
intersection()
difference()
issubset()
issuperset()
Modules
os
sys
pathlib
json
re
datetime
collections
itertools
functools
math
random
typing
dataclasses
asyncio
logging
subprocess
Statements
Compound
if
while
for
try
with
match
def
class
async
Simple
return
yield
raise
import
assert
del
pass
break
continue
global
nonlocal
type
Expressions
lambda
comprehensions
generator expressions
conditional (x if c else y)
walrus :=
f-strings
slicing
format spec
Exceptions
Exception
ValueError
TypeError
KeyError
IndexError
AttributeError
NameError
FileNotFoundError
ZeroDivisionError
RuntimeError
StopIteration
NotImplementedError
ExceptionGroup
Data Model
__init__
__repr__
__str__
__eq__
__hash__
__len__
__iter__
__getitem__
__contains__
__call__
__enter__
__exit__