From cad1d45a4bf8b6e50c5a27eb1856e8c3b348f520 Mon Sep 17 00:00:00 2001 From: shuaikangzhou <863909694@qq.com> Date: Thu, 4 Jan 2024 20:28:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84csv=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/DataBase/exporter_csv.py | 8 ++++++-- app/person.py | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/DataBase/exporter_csv.py b/app/DataBase/exporter_csv.py index 541c19eb..55b2e124 100644 --- a/app/DataBase/exporter_csv.py +++ b/app/DataBase/exporter_csv.py @@ -24,7 +24,11 @@ def to_csv(self): writer = csv.writer(file) writer.writerow(columns) # 写入数据 - writer.writerows(messages) + # writer.writerows(messages) + for msg in messages: + other_data = [msg[12].remark, msg[12].nickName, msg[12].wxid] if self.contact.is_chatroom else [] + writer.writerow([*msg[:9], *other_data]) self.okSignal.emit('ok') + def run(self): - self.to_csv() \ No newline at end of file + self.to_csv() diff --git a/app/person.py b/app/person.py index 2f05bb05..9cb416e0 100644 --- a/app/person.py +++ b/app/person.py @@ -61,6 +61,8 @@ def __init__(self): self.name = '' self.mobile = '' self.smallHeadImgUrl = '' + self.nickName = self.name + self.remark = self.nickName class Contact(Person): @@ -79,7 +81,7 @@ def __init__(self, contact_info: Dict): self.avatar_path = Icon.Default_avatar_path self.is_chatroom = self.wxid.__contains__('@chatroom') self.detail = contact_info.get('detail') - self.label_name = contact_info.get('label_name') # 联系人的标签分类 + self.label_name = contact_info.get('label_name') # 联系人的标签分类 """ detail存储了联系人的详细信息,是个字典