Bernard Lebel wrote:

> Hello,
> 
> I would like to know if there is a way to know how much memory (bytes,
> kilobytes, megabytes, etc) a name is using.
> 
> More specifically, I have this list of strings that I want to write to
> a file as lines.
> This list grows througout the script execution, and toward the end,
> the file is written.
> 
> However I would like to know how much memory, before writing to the
> file, is this list using. Is it possible at all?

How about summing up the individual string lengths?

total = sum(len(s) for s in my_list)


Diez
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to