Get the App
SLTechnology News&Howtos  ›  Development  › 

How python uses requests to download files

Shulou Source: shulou.com Published: 2022-06-01 02:09:17 09月21日 Update

This article mainly introduces python how to use requests to download files, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Requests

You can return the meta information of HTTP.

Import requests r = requests.get (url) with open ('. / image/logo.png', 'wb') as f: f.write (r.content) # Retrieve HTTP meta-dataprint (r.status_code) print (r.headers [' content-type']) print (r.encoding) Thank you for reading this article carefully. I hope the article "python how to download files using requests" shared by the editor will be helpful to you. At the same time, I hope you will support it. Pay attention to the industry information channel, more related knowledge is waiting for you to learn!

Tags: Articles documents value information interests at the same time more friends knowledge editing industry information information channels channels reference learning help support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Apple Linux Microsoft Docker