From 86bda4e945cc905a612e8cca519e1d7b6534395c Mon Sep 17 00:00:00 2001
From: xieshen <1397910458@qq.com>
Date: Thu, 10 Dec 2020 15:13:35 +0800
Subject: [PATCH] =?UTF-8?q?#=E6=9B=B4=E6=8D=A2=E6=9C=8D=E5=8A=A1=E5=99=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
dashboard/templates/dashboard/home.html | 2 +-
新媒体更新脚本/查找单位行政区划更改.py | 0
新媒体更新脚本/查找微信名称更改.py | 30 ++++++++++++-------------
3 files changed, 15 insertions(+), 17 deletions(-)
create mode 100644 新媒体更新脚本/查找单位行政区划更改.py
diff --git a/dashboard/templates/dashboard/home.html b/dashboard/templates/dashboard/home.html
index 5a91351..0ec6f6f 100644
--- a/dashboard/templates/dashboard/home.html
+++ b/dashboard/templates/dashboard/home.html
@@ -63,7 +63,7 @@
预警次数
-
{{ news_count }}
+
362
diff --git a/新媒体更新脚本/查找单位行政区划更改.py b/新媒体更新脚本/查找单位行政区划更改.py
new file mode 100644
index 0000000..e69de29
diff --git a/新媒体更新脚本/查找微信名称更改.py b/新媒体更新脚本/查找微信名称更改.py
index d4c7878..94ba654 100644
--- a/新媒体更新脚本/查找微信名称更改.py
+++ b/新媒体更新脚本/查找微信名称更改.py
@@ -25,7 +25,7 @@ def get_csv_weixin(path):
with open("D:/2020/新媒体监测/新媒体对比结果_微信_账号名称更改.csv", "w", newline='',encoding='utf-8') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(
- ["序号", "冲突账号"])
+ ["账号", "备注"])
weixin_code_list = []
csv_code_list = []
with open(path, encoding='utf-8') as csvfile:
@@ -33,7 +33,7 @@ def get_csv_weixin(path):
for r in reader:
if r[1] != '单位全称':
if '微信' in r[7]:
- print(r)
+ # print(r)
csv_code_list.append(r[4])
with psycopg2.connect(G2) as connection:
with connection.cursor() as cursor:
@@ -46,19 +46,17 @@ def get_csv_weixin(path):
except Exception as e:
print(e)
print(len(weixin_code_list),len(csv_code_list))
- if len(weixin_code_list) <= len(csv_code_list):
- for c in csv_code_list:
- if c in weixin_code_list:
- print(c)
- else:
- writer.writerow(
- [r[0], r[4],c,'c'])
- else:
- for w in weixin_code_list:
- if w in csv_code_list:
- print(w)
- else:
- writer.writerow(
- [w,'w'])
+
+ print( len(list(set( weixin_code_list ) ^ set( csv_code_list ))))
+ for i in list(set( weixin_code_list ) ^ set( csv_code_list )):
+ if i in weixin_code_list and i not in csv_code_list:
+ writer.writerow(
+ [i,'删除'])
+ elif i in csv_code_list and i not in weixin_code_list:
+ writer.writerow(
+ [i, '新增'])
+ else:
+ writer.writerow(
+ [i, '异常'])
if __name__ == '__main__':
get_csv_weixin('D:/2020/新媒体监测/TASK_ALL.csv')