Get the Size of an Object in Python December 4, 2019 Use getsizeof method to retrieve the size of an object in bytes. See below for an example: str = “devx” print(sys.getsizeof(str))