Python Built-in Functions and Methods
◐
Basic Operations
Type Conversion
List Methods
Dictionary Methods
String Methods
File Operations
Iterables
Basic Operations
print()
Output to stdout
len()
Get sequence length
type()
Get object type
input()
Read user input
Type Conversion
int()
Convert to integer
str()
Convert to string
float()
Convert to float
list()
Convert to list
dict()
Convert to dictionary
set()
Convert to set
List Methods
list.append()
Add item to end
list.extend()
Add iterable to end
list.pop()
Remove and return item
list.sort()
Sort in place
list.reverse()
Reverse in place
Dictionary Methods
dict.get()
Get value with default
dict.keys()
Get all keys
dict.values()
Get all values
dict.items()
Get key-value pairs
dict.update()
Update dictionary
String Methods
str.split()
Split into list
str.join()
Join iterable to string
str.strip()
Remove whitespace
str.replace()
Replace substring
str.format()
Format string
File Operations
open()
Open file
file.read()
Read entire file
file.write()
Write to file
file.close()
Close file
Iterables
range()
Generate number sequence
enumerate()
Index iterator
zip()
Combine iterables
map()
Apply function to iterable
filter()
Filter iterable