본문으로 바로가기

웹 파일 긁어오기

category Coding/Python 2016. 2. 27. 16:16
반응형

import shutil

import requests


for i in range(1, 150):

    url = 'http://test.com/'+str(i)+'.png'

    response = requests.get(url, stream=True)

    with open('./champ/'+str(i)+'.png', 'wb') as out_file:

        shutil.copyfileobj(response.raw, out_file)

    del response

반응형

'Coding > Python' 카테고리의 다른 글

Morse code encode/decode  (0) 2016.04.17
파이썬 큐 구현  (0) 2016.04.12
Mechanize 로 로그인하기  (0) 2016.02.26
파이썬 정규식 정리  (0) 2016.02.25
Python Proxy check  (0) 2016.01.30