I need to know size of objects in my python program.
I have for loop in which I need to know size of objects.
If I use sys.getsizeof then memory does not free instantly
and I cannot see actual size. Is there way to do it?
My objects are json and string. In the worst case I can
save them to file and look at file sizes. But how can I look
at file size from python code?
Edit: size of serialised objects is more important for me.
so second part of the question is essential.
Thanks.
Considering that
type(json.dumps(something))==stryou should be able to literally just uselen.Consider the following