How do I call a class function inside the class definition?
问题 class MetaData(): maxSize = 2**10 # class definition code if not os.path.exists('sample.data'): SSD = open('sample.data', 'wb+') data = { 0: [], 1: {'.': None,} } data[1]['~'] = data[1] MetaData.save() # i want to call the save function here # class function @classmethod def save(cls): cls.SSD.seek(0) cls.SSD.write(b' ' * cls.maxSize) cls.SSD.seek(0) cls.SSD.write(pickle.dumps(cls.data)) I want to use the save() function inside the class block. I've tried MetaDate.save() and simply save()