K
K
Konstantin Volkov2014-10-25 08:42:58
Python
Konstantin Volkov, 2014-10-25 08:42:58

How to save photos in python?

I need a code to download a picture from the site (preferably python)
there is a certain picture, you need to download it. Please tell me the code, for example, to download this picture https://pp.vk.me/c540104/c624218/v624218602/3321/u. ..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wiygn, 2014-10-25
@kostya__wolf

And only one person used with, some miracles. Here is an even more generic implementation for python + requests:

import requests

URL = 'https://pp.vk.me/c540104/c624218/v624218602/3321/uYVa4FQv_q0.jpg'

r = requests.get(URL)
with open(filename, 'wb') as fd:
    for chunk in r.iter_content(<int:chunk_size>):
        fd.write(chunk)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question