
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
import openpyxl
import urllib.request
wb = openpyxl.load_workbook('관리종목.xlsx')
sheet = wb['종목']
new_rows = list(sheet.rows)[1:]
for row in new_rows:
url = f'https://ssl.pstatic.net/imgfinance/chart/item/area/year3/{row[1].value}.png'
urllib.request.urlretrieve(url, f"imgs/{row[0].value}.png")
라고 정답 그대로 코랩에 입력하니
FileNotFoundError Traceback (most recent call last)
<ipython-input-14-ee36528f748c> in <module>
9 for row in new_rows:
10 url = f'https://ssl.pstatic.net/imgfinance/chart/item/area/year3/{row[1].value}.png'
---> 11 urllib.request.urlretrieve(url, f"imgs/{row[0].value}.png")
/usr/lib/python3.7/urllib/request.py in urlretrieve(url, filename, reporthook, data)
255 # Handle temporary file setup.
256 if filename:
--> 257 tfp = open(filename, 'wb')
258 else:
259 tfp = tempfile.NamedTemporaryFile(delete=False)
FileNotFoundError: [Errno 2] No such file or directory: 'imgs/삼성전자.png'
라는 결과 창이 뜹니다. 삼성전자라고 입력한것도 없는데 왜 자꾸 삼성전자 파일이나 디랙토리가 없다고 뜨는 걸까요?
