class Test:
def __init__(self, totals, uniques, pre):
self.totals = totals
self.uniques = uniques
self.cumulative_sum = totals
if pre:
self.cumulative_sum +=pre.cumulative_sum
pre = Test(100, 200, None)
a = Test(1000, 2000, pre)
import json
d = [json.loads(json.dumps(i.__dict__)) for i in [pre, a]]
ddd = 9
翻译
搜索
复制
标签:pre,__,self,totals,json,Test,序列化,类转 From: https://www.cnblogs.com/papering/p/18209155