Last active
April 29, 2018 22:18
-
-
Save santosh/eafed46689143c3f2ba7f02ee844590f to your computer and use it in GitHub Desktop.
Python's builtin functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Interpreter candy | |
help() - help for specified object | |
dir() - like ls for a class | |
type() - object type | |
print() - print object | |
len() - length of object | |
id() - returns id of an object | |
input() - takes input from stdin | |
exec() | |
range() - sequence type | |
open() - open a file or gives an OSError | |
sorted - sorts given dataset | |
Data type conversion | |
float() - turns int into float | |
int() - turns float into int | |
chr() - turns ascii index into string | |
ord() - opposite of chr | |
oct() - turns to base 8 int | |
str() - turns int or float into string | |
bytes() - turns str into bytes | |
list() - turns dataset into list | |
dict() - tries to dicts anything | |
tuple() - turns dataset into tuple | |
bool() - bool is a class | |
bin() - turns into binary | |
hex() | |
ascii() - escape non ascii chars | |
format() - for formatting string | |
Maths | |
pow() - to the power | |
abs() - absolute value of a number | |
min() - minimum of give dataset | |
max() - maximum of a dataset | |
round() - round floats to ints | |
Iteration | |
itertools | |
sum() - sums given iteration or list | |
filter() - | |
enumerate() - adds count to the dataset | |
map() | |
next() | |
iter | |
zip() - enumerate for 2 lists | |
set() - unique items from datasets, have no order | |
all() - | |
any | |
classmethod | |
compile | |
complex | |
divmod | |
eval | |
frozenset() | |
getattr() | |
globals | |
hasattr() | |
hash() | |
isinstance() | |
issubclass() | |
locals | |
memoryview | |
property | |
repr | |
reversed | |
set | |
setattr | |
slice | |
vars | |
Core | |
staticmethod | |
super | |
delattr | |
bytearray | |
callable | |
object - base object for all objects |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment