size of list pythn code example
Example 1: how to get size of list in python
list_1 = ["Hello", 1, "World", 2]
# if you want length of this lins use len() function
print(len(list_1))
# if you want size in bytes
import sys
print(sys.getsizeof(list_1), "Bytes")
Example 2: python list of size
li = [None] * 5 # [None, None, None, None, None]
li = [0] * 5 # [0, 0, 0, 0, 0]