
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
now만 안붙이면 잘 나오는데 now만 붙이면 에러가 나네요.

작성한 코드 및 에러 메세지
import requests
from bs4 import BeautifulSoup
from openpyxl import Workbook
from datetime import datetime # 날짜 가져오는 라이브러리 추가 설치
def get_news(keyword): # get_news 라는 함수를 만들기
wb= Workbook()
sheet = wb.active
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'}
data = requests.get(f'https://search.naver.com/search.naver?where=news&ie=utf8&sm=nws_hty&query={keyword}',headers=headers) # f스트링 방식
soup = BeautifulSoup(data.text, 'html.parser')
lis = soup.select('#main_pack > section > div > div.group_news > ul > li')
for li in lis:
a = li.select_one('a.news_tit')
row = [a.text, a['href']] # 기사제목과 링크를 row라는 리스트로 만들어주고,
sheet.append(row) # sheet에 추가해줌
today = datetime.today().strftime("%Y-%m-%d") # 날짜를 가져와서 today라는 변수에 저장
wb.save(f"now/{today}_{keyword}.xlsx") # 파일명에 today 변수 추가 + news라는 폴더에 쌓이도록
wb.close()
FileNotFoundError Traceback (most recent call last)
<ipython-input-36-82724b372f00> in <cell line: 1>()
----> 1 get_news('삼성전자')
3 frames
/usr/lib/python3.10/zipfile.py in __init__(self, file, mode, compression, allowZip64, compresslevel, strict_timestamps) 1249 while True: 1250 try: -> 1251 self.fp = io.open(file, filemode) 1252 except OSError: 1253 if filemode in modeDict:
FileNotFoundError: [Errno 2] No such file or directory: 'now/2023-10-13_삼성전자.xlsx'
