python - 为什么python gzip会引发关闭文件错误?
问题描述
我有一个要解压缩的文件。它存储在一个变量中。
代码:
print(bytes_db)
with gzip.open(bytes_db, 'rb') as db:
print(db)
db.read()
结果是关闭文件上的错误。完整输出:
<gzip on 0x7f2737f23250>
<gzip gzip on 0x7f2737f23250 0x7f273c5e3430>
ValueError: I/O operation on closed file
解决方案
推荐阅读
- java - 在 AEM 中,如何将项目环境放入我的 sling 模型中
- c++ - 迭代本身正在修改的容器的 C++ 惯用方式
- c# - 在 Azure Blob 存储中创建并上传到特定文件夹
- awk - 按模式剥离文件的最后一部分 - 从链中删除最后一个证书
- android - 适用于 Android 的 ShawnLin numberpicker 库 - 如何使文本垂直对齐?
- matlab - 使用 lsim 时设置 u 向量
- excel - 给定 StartDate 和 EndDate,返回 Dates 表中的匹配行
- android-studio - Android Studio 在每个文件上显示 C++ 文件图标
- node.js - 通过 Doctl 部署到 DigitalOcean 应用平台时出现 500 HTTP 错误
- reactjs - 即使使用 react-script 3.4.3,CRA 可选链接也不起作用