라이브러리 입니다
import wget
import math
import re
from urllib import request
받을 주소와 파일 리스트 입니다
url = "ftp://ftp.hycom.org/datasets/GLBy0.08/expt_93.0/data/hindcasts/2021/"
html = request.urlopen(url)
html_contents = str(html.read().decode("cp949"))
url_list = re.findall(r"(hycom_GLBy0.08_930)(.+)(_ice.nc)", html_contents)
반복문으로 지속적으로 받기위한 코드 입니다
for url in url_list:
url_full = "".join(url)
file_name = url_full.split("/")[-1]
print('\nDownloading ' + file_name)
wget.download(url_full)
실행하면 ValueError: unknown url type: 'hycom_GLBy0.08_930_2021010112_t000_ice.nc'
가 나네요.
에러난 위치는
ValueError Traceback (most recent call last)
<ipython-input-23-c74ca47dac5e> in <module>
3 file_name = url_full.split("/")[-1]
4 print('\nDownloading ' + file_name)
----> 5 wget.download(url_full)
이렇습니다. 혹시 제가 실수한 부분이 있을까요?