with open('studentList.csv', mode='r', encoding='utf-8') as stuData:
lsStu = [line.strip().split(',') for line in stuData]
with open('schoolCode.csv', mode='r', encoding='utf-8') as schData:
lsSch = [line.strip().split(',') for line in schData]
dicSch = {x[0]: x[1] for x in lsSch}
with open('MajorCode.csv', mode='r', encoding='utf-8') as MajorData:
lsMajor = [line.strip().split(',') for line in MajorData]
dicMajor = {x[0]: x[1] for x in lsMajor}
lsStuNew = []
for id in lsStu:
s = '012'
s = s + id[5][2:] + dicSch[id[2]] + dicMajor[id[3]] + id[4][-4:] + '{0:0>2}'.format(
[x[0] for x in lsStu if id[4] == x[4]].index(id[0]) + 1)
lsStuNew.append([s] + id)
stuName, stuClass = input(), input()
[print(*id) for id in lsStuNew if id[1] == stuName]
[print(*id) for id in lsStuNew if id[5] == stuClass]
04-05
3323
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-23
2740
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-28
1195
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)