Open ogre0403 opened 7 years ago
使用Python requests module下載檔案,需給定儲存的檔案名稱
file_name = abspath + name +"." + fileType.strip(";\"") with open(file_name, 'wb') as f: for chunk in response.iter_content(chunk_size=1024): if chunk: f.write(chunk)
但有時從http request header無法取到正確檔名/副檔名, 甚至有時open data取下來的資訊裡,file type也不正確。
使用Python requests module下載檔案,需給定儲存的檔案名稱
但有時從http request header無法取到正確檔名/副檔名, 甚至有時open data取下來的資訊裡,file type也不正確。