1 Answer
New AnswerYou can use sizeof operator to find it out. You can either import getsizeof method from the sys module: from sys import getsizeof print(getsizeof(20)) #Prints the sizeof the integer 20. Objects should also have a magicmethod, might be discouraged from using, but works: print((20).__sizeof__()) Remember that you would sometimes need parentheses, for example 20.__sizeof__() would result in errors, with variables this doesn't cause problems: a = 20 print(a.__sizeof__())
Learn Playing. Play Learning
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message