newmediamonitoring/新媒体更新脚本/添加矩阵成员.py

35 lines
817 B
Python
Raw Normal View History

2020-12-08 13:19:10 +00:00
# 更新新媒体脚本,结果为有出入的新媒体列表。
'''
1,将excel转为csv使用utf-8编码集
2获取csv内容
3与数据库中的数据逐项对比
'''
import csv
import uuid
import psycopg2 as psycopg2
# code = None
# alias = None
# attention = None
# remark = None
# identificationcode = None
# function = None
# articleurl = None
# weixinid = None
# type = None
G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=newmedia2020!@#'
def get_csv_weixin(path):
with open(path, encoding='utf-8') as csvfile:
reader = csv.reader(csvfile)
for r in reader:
if r[1] != '单位全称':
if '' in r[7]:
print(r)
if __name__ == '__main__':
get_csv_weixin('D:/2020/新媒体监测/TASK_ALL.csv')