티스토리 뷰
image_list.txt :
file_name_1
file_name_2
file_name_3
image url :
http://www.test.com/download/image/file_name_1.jpg
http://www.test.com/download/image/file_name_2.jpg
http://www.test.com/download/image/file_name_3.jpg
def getImageList():
image_list_files = open('c:/image_list.txt', 'r')
total_lines = image_list_files.readlines()
for image in total_lines:
if image != '':
# 엔터가 붙어있기에 치환해준다.
image_name = image.replace("\n", "")
getImageDownload(image_name)
image_list_files.close()
def getImageDownload(image_name):
# 다운받을 로컬 디렉토리
save_file_path = "%s%s" % ("c:/image_download/", image_name + ".jpg")
save_local_directory = file(file_path, "wb")
# 파일 다운로드
image_file = urllib.urlopen("http://www.test.com/download/image/" + image_name +".jpg")
while True:
buf = image_file.read(100000000)
if len(buf) == 0:
break
save_local_directory.write(buf)
save_local_directory.close()
image_file.close()
# call
getImageList()
'프로그래밍' 카테고리의 다른 글
[ETC] Singleton Pattern (0) | 2016.12.24 |
---|---|
[ETC] Cron Tab (0) | 2016.12.24 |
[JAVASCRIPT] 유니코드 -> 한글, 한글 -> 유니코드 변환 (0) | 2016.12.24 |
[JAVASCRIPT] MAP 사용 (0) | 2016.12.24 |
[JAVASCRIPT] 클립보드에 복사하기 (0) | 2016.12.24 |
- Total
- Today
- Yesterday
- Namibia
- 킹덤 호텔
- 우유니
- 빈트후크
- 칠레
- 후마리
- 푸에르토 나탈레스
- 성계 투어
- 토레스 델 파이네
- 족발
- calama
- 남미 저가항공
- 햄버거
- Cusco
- Oracle
- 마추피추
- jQuery
- 애드센스
- Uyuni
- 나미비아
- aguas calientes
- 볼리비아
- 캄보디아
- Cambodia
- 성스러운 계곡
- 남미
- 쿠스코
- 칼라마
- 빅토리아폴스
- 아구아스 칼리엔테스
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |