此随笔记录在使用python过程中遇到的所有问题
1. linecache处理中文
import linecache fh = open('test.txt','r',encoding='utf-8') try: line = linecache.getline('test.txt',5) print(line) finally: fh.close()