-
카테고리
-
세부 분야
데이터 분석
-
해결 여부
미해결
맥 os에서 실행시 파일저장
19.01.11 19:19 작성 조회수 127
0
맥 os의 아톰에서 하기 문장을 입력 후 실행시,
실행은 되나, 저장된 파일이 안보이네요.
이유가 무엇인지요?
import sys
import io
import urllib.request as dw
sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8')
imgUrl ="http://post.phinf.naver.net/20160621_169/1466482468068lmSHj_JPEG/If7GeIbOPZuYwI-GI3xU7ENRrlfI.jpg"
htmlURL ="http://google.com"
savePath1 ="/Users/ken/test1.jpg"
savePath2 ="/Users/ken/index.html"
f = dw.urlopen(imgUrl).read()
f2 = dw.urlopen(htmlURL).read()
saveFile1 = open(savePath1,'wb') # w : write , r : read , a : add
saveFile1.write(f)
saveFile1.close()
with open(savePath2,'wb') as saveFile2:
saveFile2.write(f2)
print("다운로드 완료!")
답변을 작성해보세요.
답변 0