亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

解壓文件時出錯 - Jupyter Notebook - Python 2.x -3.x

解壓文件時出錯 - Jupyter Notebook - Python 2.x -3.x

精慕HU 2023-11-09 21:56:47
我正在嘗試從https://www.fec.gov/data/browse-data/?tab=bulk-data下載 .zip 文件,特別是https://www.fec.gov/files/bulk-downloads/2020 /indiv20.zip。壓縮后,文件大小為 2.7 GB。下載將在 10 秒內啟動并完成。當我嘗試解壓縮該文件時,我收到以下錯誤消息。下載到我的本地計算機時,鏈接會以 .zip 文件形式下載并打開所需的數據。!python --versionPython 3.7.8!curl -O https://www.fec.gov/files/bulk-downloads/2020/indiv20.zip  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current Dload  Upload   Total   Spent    Left  Speed 100   138  100   138    0     0    690      0 --:--:-- --:--:-- --:--:--   690!unzip -a indiv20.zipArchive:  indiv20.zip 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 indiv20.zip or indiv20.zip.zip, and cannot find indiv20.zip.ZIP, period. import zipfilewith zipfile.ZipFile("indiv20.zip", 'r') as zip_ref:    zip_ref.extractall()
查看完整描述

2 回答

?
HUX布斯

TA貢獻1876條經驗 獲得超6個贊

看起來 HTTP 服務器正在返回重定向,并將curl“302 Found”消息存儲到 indiv20.zip 文件中,而不是實際的 ZIP 數據中。

您可以通過在命令中添加-L(或--location)參數來解決此問題curl,以便它遵循重定向:

$?curl?-LO?https://www.fec.gov/files/bulk-downloads/2020/indiv20.zip


查看完整回答
反對 回復 2023-11-09
?
米脂

TA貢獻1836條經驗 獲得超3個贊

檢查文件的內容。這可能是 html 中的錯誤消息。(cat indiv20.zip)



查看完整回答
反對 回復 2023-11-09
  • 2 回答
  • 0 關注
  • 206 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號