在python中从gzip文件读取utf-8字符

在python中从gzip文件读取utf-8字符,第1张

在python中从gzip文件读取utf-8字符

我不明白为什么这应该这么难。

你到底在做什么 请解释“最终它读取了无效字符”。

它应该很简单:

import gzipfp = gzip.open('foo.gz')contents = fp.read() # contents now has the uncompressed bytes of foo.gzfp.close()u_str = contents.depre('utf-8') # u_str is now a unipre string


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5662691.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存