我是使用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笔记本中运行良好。