文本文件读写
| 1 2 3 4 5 6 7 8 9 10 11 | # 读文件 with open('1.txt', 'r') as f:     print(f.read())     list1 = f.readlines()     for i in list1:         s = i.rstrip('\n') # 写文件 with open('2.txt', 'w') as f2:     f2.writelines('new line' + '\n') | 
GBK编码格式文件读取
| 1 2 | f = open('gbk.txt', 'r', encoding='gbk') | 
