This is a draft cheat sheet. It is a work in progress and is not finished yet.
Methods
string.count() |
returns number of times a value occurs in a string |
string.index() |
returns index of given value |
s.join() |
joins elements in an iterable by the provided string |
s.replace(old,new) |
replaces all occurences of the substring with new substring |
s.split() |
splits string at given sub, returns list |
s.upper() |
uppercase |
L.append() |
adds item to END of list |
L.copy() |
returns copy of List |
L.count() |
returns count of elements |
L.index() |
returns index of first occurence |
L.insert(Idx,value) |
inserts value at that index, nothing removed |
L.pop(Idx) |
removes item at index |
L.remove(value) |
removes first occurence of value |
L.reverse() |
reverses order of list |
L.sort() |
sorts list alphabetically |
D.clear() |
makes given D empty |
D.copy() |
returns copy of D |
D.get(key) |
returns value of key |
D.items() |
returns list of tuple of D(K,V) |
D.keys() |
returns list of keys |
D.values() |
returns list of values |
Functions
adding () will call the function |
print(lambda x:x) prints the type function |
Passing mutable objects into functions will mutate that object for future uses |
|
|
|
|
|
|
|