23

file1 = open('C:/Users/86136/Documents/python文件测试/Python成绩登记信计1.csv', 'r',encoding='UTF_8').readlines()
fileout = open('C:/Users/86136/Documents/python文件测试/Python成绩登记信计2.csv','w',encoding='UTF_8')
for line in file1:
    fileout.write(line.replace('优秀','90'))
fileout.close()

 

file1 = open('C:/Users/86136/Documents/python文件测试/Python成绩登记信计2.csv', 'r',encoding='UTF_8').readlines()
fileout = open('C:/Users/86136/Documents/python文件测试/Python成绩登记信计3.csv','w',encoding='UTF_8')
for line in file1:
    fileout.write(line.replace('良好','80'))
fileout.close()

  

file1 = open('C:/Users/86136/Documents/python文件测试/Python成绩登记信计3.csv', 'r',encoding='UTF_8').readlines()
fileout = open('C:/Users/86136/Documents/python文件测试/Python成绩登记信计4.csv','w',encoding='UTF_8')
for line in file1:
    fileout.write(line.replace('不合格','0'))
fileout.close()

  

file1 = open('C:/Users/86136/Documents/python文件测试/Python成绩登记信计4.csv', 'r',encoding='UTF_8').readlines()
fileout = open('C:/Users/86136/Documents/python文件测试/Python成绩登记信计5.csv','w',encoding='UTF_8')
for line in file1:
    fileout.write(line.replace('合格','60'))
fileout.close()

  

 

posted on 2020-05-24 02:20  #f#f  阅读(164)  评论(0)    收藏  举报

导航