赞
踩
def to_json_all(msg: list): import json data = {} if type(msg) == list: for i in range(len(msg)): temp_dict = {} j = 0 for k, v in msg[i].__dict__.items(): if j > 0: temp_dict[k] = v j += 1 data[i] = temp_dict else: temp_dict = {} j = 0 for k, v in msg.__dict__.items(): if j > 0: temp_dict[k] = v j += 1 data[0] = temp_dict return json.dumps(data, ensure_ascii=False)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。