Finding size of Variable

Dave Angel davea at davea.name
Tue Feb 4 20:21:31 CET 2014


 Ayushi Dalmia <ayushidalmia2604 at gmail.com> Wrote in message:

> 
> Where am I going wrong? What are the alternatives I can try?

You've rejected all the alternatives so far without showing your
 code, or even properly specifying your problem.

To get the "total" size of a list of strings,  try (untested):

a = sys.getsizeof (mylist )
for item in mylist:
    a += sys.getsizeof (item)

This can be high if some of the strings are interned and get
 counted twice. But you're not likely to get closer without some
 knowledge of the data objects and where they come
 from.

-- 
DaveA




More information about the Python-list mailing list