使用python提取/读取Google colab jupyter笔记本中.gz文件的内容

问题描述

我是使用google colab的初学者,但是我没有找到读取.gz文件内容的方法。 我尝试运行以下代码:

    full_path = /content/gdrive/My Drive/7ParkData.zip/2016/09/03/00/US/CR/1d38180c9c6ab36c/part-00001-00016.gz

    with gzip.open(full_path,'rt',encoding = 'utf8')
    !gunzip full_path -d "/content/gdrive/My Drive"
    !gz xvf full_path -d "/content/gdrive/My Drive"
    shutil.unpack_archive(full_path,"/content/gdrive/My Drive/")

“ full_path”是动态的,因为其意图是读取多个.gz文件并根据需要存储内容。 “ gzip.open”代码在我的本地jupyter笔记本中运行良好。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)