有两个文件,一个存储学号,姓名,另一个存储学号,成绩。通过学号,整合出姓名,成绩

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#coding=utf-8
dictname ={}
dictgrade = {}
for line in open('C:\Users\xxx\Desktop\\name.txt'):
    param = line.split()
    params = {param[0]:param[1]}
    dictname.update(params)
print dictname

for item in open("C:\Users\xxxx\Desktop\grade.txt"):
    items = item.split()
    dictgrade[items[0]] = int(items[1])
print dictgrade

dictstu={}
for (key, name) in dictname.items():
    value = dictgrade.get(key, '-')
    pitem = {name:value}
    dictstu.update(pitem)

print dictstu