python问题汇总

此随笔记录在使用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()
posted @ 2019-09-20 14:28  jiguanghover  阅读(141)  评论(0编辑  收藏  举报