Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import decimal
- # Reference for the memory size of Python data structure
- d = {
- "int": 0,
- "float": 0.0,
- "dict": dict(),
- "set": set(),
- "tuple": tuple(),
- "list": list(),
- "str": "a",
- "unicode": u"a",
- "decimal": decimal.Decimal(0),
- "object": object(),
- }
- for k, v in sorted(d.items()):
- # Return the size of object in bytes >>>
- print(k, sys.getsizeof(v))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement