python - 如何使用 Google Colab 解压缩 .gz 文件?
问题描述
我下载了带有 .gz 扩展名的英文 FastText 嵌入文件。当我打算使用 Google Colab 解压缩它时,我收到以下错误:
Archive: /content/drive/My Drive/New_ABCDM_Architec/cc.en.300.vec.gz End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of /content/drive/My Drive/New_ABCDM_Architec/cc.en.300.vec.gz or /content/drive/My Drive/New_ABCDM_Architec/cc.en.300.vec.gz.zip, and cannot find /content/drive/My Drive/New_ABCDM_Architec/cc.en.300.vec.gz.ZIP, period
\n!unzip '/content/drive/My Drive/New_ABCDM_Architec/cc.fr.300.vec.gz'\n!unzip '/content/drive/My Drive/New_ABCDM_Architec/cc.ar.300.vec.gz'\n
我知道要使用!unzip
该文件应该有一个 .zip 扩展名。我的问题是,如何解压缩 .gz 文件?
解决方案
!tar -xzvf "/content/drive/path/file_name.tar.gz" "/content/drive/path/destination_directory"
标志
- -x : 提取
- -c :创建一个新的存档
- -v :详细输出
- -f :使用给定的存档文件(name.extention)
- -z : 通过 gzip 过滤存档
- -j : 通过 bzip2 过滤存档
推荐阅读
- elasticsearch - 如何更动态地计算具有字符串数组值的文档
- reactjs - 使用 Next.js 导入动态英雄图标
- google-apps-script - Google 表格插件 - 未找到已发布版本的 POST 端点
- c++ - 没有数据成员的派生类的引用提升
- javascript - 模态按钮未在单击时注册
- python - 尝试使用 Scrapy 抓取一些东西,但是 csv 文件是空的,这是什么问题?
- c# - 在 UWP 类库中设置用户控件的样式并在使用应用程序中覆盖它
- html - HTML 电子邮件页脚问题
- javascript - 如何在Javascript中更新对象中的数组
- python - 列表中的 lambda 和过滤器