forked from C1499/attendanceScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
attendance.py
51 lines (47 loc) · 1.48 KB
/
attendance.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import csv
import xlrd3
def today(file):
l = []
with open(file,'rt') as f:
cr = csv.reader(f)
for row in cr:
l.append(row)
f.close()
return l
def peoples(file):
peopleList = []
wb = xlrd3.open_workbook(filename=file)
sheet1 = wb.sheet_by_index(0)
for i in range(1,sheet1.nrows):
peopleList.append(sheet1.row(i)[2].value)
wb.release_resources()
return peopleList
def judge():
peopleList = peoples(input("请输入成员列表文件名(带后缀名,xlsx格式)\n"))
#需要删除的成员名
peopleList.remove("")
todayList = today(input("请输入考勤列表文件名(带后缀名,csv格式)\n"))
rpeople = peopleList.copy()
repeat = []
i=0
print("\n")
for rows in todayList:
if rows:
for people in peopleList:
if(people in rows[0] and len(rows)>1):
if(int(rows[2])<170):
print("时长异常:",people,rows[2],rows[3])
if(people in rpeople):
rpeople.remove(people)
else:
i-=1
repeat.append(people)
i+=1
if repeat:
print("\n多次出现:",repeat,"\n")
if rpeople:
print("今日未在线:",rpeople)
print("今日总人数:",i)
if __name__ == '__main__':
judge()
temps=input("\n")