This is a draft cheat sheet. It is a work in progress and is not finished yet.
Map Function
# Useful instead of for loop, returns a map object -> need to transform as a list
map(function, iterable, [iterable 2, iterable 3, ...]) # General expression
mapped_numbers = list(map(lambda x: x * 2 + 3, numbers)) # Exemple
|
Dictionnaries
dict1.update(dict2) # merge the 2 dictionnaries together
dict3 = {**dict1, **dict2} # Merge the 2 dictionnaries into a 3rd one
dict3 = dict1 | dict2 # also work
dict3 = dict(dict1.items() | dict2.items()) # merge the 2 dictionnaries together randomly
|
|
|
Join Function
variable = " ".join(YourList)
|
|