with open(r'E:\a.txt','r') as f1: f2 = f1.read() #打印a.txt内容 for i in f2: print(i,end=' ') #小写转大写 s = f2.upper() with open(r'E:\b.txt','w') as f3: f3.write(s)