【问题标题】:How to unzip .gz file using Google Colab?如何使用 Google Colab 解压缩 .gz 文件?
【发布时间】:2021-12-26 02:13:47
【问题描述】:

我下载了带有 .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 文件?

【问题讨论】:

  • !gunzip filenametar -xzf filename ?
  • @GhostOps 感谢您的回复。 “!gunzip”对我有用。

标签: python google-colaboratory unzip


【解决方案1】:
!tar -xzvf "/content/drive/path/file_name.tar.gz" "/content/drive/path/destination_directory"

 

标志

  • -x : 提取
  • -c : 创建一个新存档
  • -v : 详细输出
  • -f : 使用给定的存档文件(name.extention)
  • -z : 通过 gzip 过滤存档
  • -j : 通过 bzip2 过滤存档

【讨论】:

    猜你喜欢
    • 2011-03-18
    • 2015-09-10
    • 1970-01-01
    • 2014-07-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-06
    相关资源
    最近更新 更多