memory - python- how to display size of all variables -
i want print memory size of variables in scope simultaneously.
something similar to:
for obj in locals().values(): print sys.getsizeof(obj)
but variable names before each value can see variables need delete or split batches.
ideas?
you can iterate on both key , value of dictionary using .items()
for var, obj in locals().items(): print var, sys.getsizeof(obj)
Comments
Post a Comment