장수창

status to txt file

...@@ -3,7 +3,7 @@ from bs4 import BeautifulSoup ...@@ -3,7 +3,7 @@ from bs4 import BeautifulSoup
3 from datetime import datetime 3 from datetime import datetime
4 4
5 day_month = datetime.today().month 5 day_month = datetime.today().month
6 -day_day = datetime.today().day 6 +day_day = datetime.today().day
7 7
8 data = [] 8 data = []
9 url='https://search.naver.com/search.naver?sm=top_hty&fbm=1&ie=utf8&query=%EC%BD%94%EB%A1%9C%EB%82%98+%ED%98%84%ED%99%A9' 9 url='https://search.naver.com/search.naver?sm=top_hty&fbm=1&ie=utf8&query=%EC%BD%94%EB%A1%9C%EB%82%98+%ED%98%84%ED%99%A9'
...@@ -19,7 +19,11 @@ datasets = datasets[1:] ...@@ -19,7 +19,11 @@ datasets = datasets[1:]
19 datasets = datasets[:-1] 19 datasets = datasets[:-1]
20 for i in range(0,4): 20 for i in range(0,4):
21 datasets[i] = datasets[i].replace(" ","") 21 datasets[i] = datasets[i].replace(" ","")
22 -
23 -datasets.append(day_month)
24 -datasets.append(day_day)
25 -print(datasets)
...\ No newline at end of file ...\ No newline at end of file
22 +
23 +# insert into text file
24 +date = f"{day_month}월 {day_day}일"
25 +f = open("status.txt", 'w')
26 +f.write(date + "\n")
27 +for i in datasets:
28 + f.write(i + "\n")
29 +f.close()
...\ No newline at end of file ...\ No newline at end of file
......
1 +6월 17일
2 +확진환자12,155
3 +격리해제10,760
4 +검사진행22,632
5 +사망자278