#更换服务器
This commit is contained in:
parent
c2a9c03921
commit
2241ef6ffa
|
@ -22,13 +22,30 @@ G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=new
|
||||||
|
|
||||||
|
|
||||||
def get_csv_weixin(path):
|
def get_csv_weixin(path):
|
||||||
|
p_list = []
|
||||||
with open(path, encoding='utf-8') as csvfile:
|
with open(path, encoding='utf-8') as csvfile:
|
||||||
reader = csv.reader(csvfile)
|
reader = csv.reader(csvfile)
|
||||||
for r in reader:
|
for r in reader:
|
||||||
if r[1] != '单位全称':
|
if r[1] != '单位全称':
|
||||||
if '' in r[7]:
|
if '兰州市' in r[10]:
|
||||||
print(r)
|
p_list.append(r[14])
|
||||||
|
print(len(list(set(p_list))))
|
||||||
|
for l in list(set(p_list)):
|
||||||
|
print(l)
|
||||||
|
with psycopg2.connect(G2) as connection:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
try:
|
||||||
|
cursor.execute(
|
||||||
|
"select * from dashboard_userprofile where name = '%s'" %(l))
|
||||||
|
connection.commit()
|
||||||
|
for c in cursor:
|
||||||
|
print(c[11])
|
||||||
|
id = uuid.uuid4()
|
||||||
|
cursor.execute(
|
||||||
|
"insert into dashboard_group_user(id,created, updated, group_id, user_id) values (%s,now(),now(),'dc85d7a7-5c9a-4aa1-b872-ebc16b1eb0e2',%s)", (str(id), c[11]))
|
||||||
|
connection.commit()
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
get_csv_weixin('D:/2020/新媒体监测/TASK_ALL.csv')
|
get_csv_weixin('D:/2020/新媒体监测/TASK_ALL.csv')
|
||||||
|
|
Loading…
Reference in New Issue