How to get the memory usage of a dictionary in Python

1 Answer

0 votes
from sys import getsizeof

dict = {
    'name': None,
    'age': 60,
    'country': None,
    'language': 'Python',
    'year': 2022
}

print(getsizeof(dict), 'bytes')  

 
 
 
'''
run:
 
232 bytes

'''

 



answered Jun 17, 2022 by avibootz

Related questions

1 answer 125 views
1 answer 160 views
2 answers 135 views
...