Skip to content

Concise notes

How to save all objects

import dill
# to save session
dill.dump_session('backup_2021_10_22.db')
# to load 
backup_restore = dill.load_session('backup_2021_10_22.db')

Function

In the context of programming, a function is a sequence of statements that performs a computation. Functions has three parts; argument, script, and output. Python has two kinds of function: built-in function that is in the core of Python or are collected as package. User-defined function that is written by user.

How find most most unique item

If you need to count of each unique item from an object, use module collections module, the following code return the 3 most common items from the given object:

from collections import Counter
c = Counter(l)
c.most_common(3)