1 with open('testRead.txt', 'r', encoding='utf-8') as f: 2 for each_line in f: 3 Pass 4 with open('testWrite.txt', 'w', encoding='utf-8') as f: 5 f.write('写入的内容'+ ' ') # 如果写入后要换行就要加