Skip to content

Instantly share code, notes, and snippets.

@Zxilly
Created Apr 3, 2021
Embed
What would you like to do?
青年大学习统计
import csv
from openpyxl import load_workbook
wb = load_workbook(filename='total.xlsx', read_only=True)
ws = wb['Sheet1']
total_students = {}
for row in ws.rows:
name = row[1].value
class_name = row[0].value
if name != '姓名':
total_students[name] = class_name
done_students = {}
with open('09fe97c2e49f56742a8bca860c6f0ae1.csv', 'r') as f:
csv = csv.reader(f)
for one in csv:
name = one[5]
if one[1] in ["", "一级组织"]:
pass
else:
done_students[name] = one
undone_students = {}
for one in total_students.keys():
if one not in done_students.keys():
undone_students[one] = total_students[one]
dirty_data = []
for one in done_students.keys():
if one not in total_students.keys() and one not in undone_students.keys():
dirty_data.append(done_students[one])
print(undone_students)
print(dirty_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment