pyton读取gbk格式txt

import os,codecs
with codecs.open(path,'r','utf-8') as f:
    content = f.read()
    content = content.encode('utf-8').decode('utf-8')
print(content)

 

posted @ 2023-06-14 15:46  airgeek  阅读(6)  评论(0编辑  收藏  举报