스터디 피드 | 소규모 코딩 교육, 코딩좀알려주라!



<4?? ????>????????<???? 1>??import requests?from bs4 import BeautifulSoup??import openpyxl?wb = openpyxl.Workbook()?sheet = wb.active?sheet.append(["??","??"])?for p in range(1, 6):???? raw = requests.get(""+str(p),??????????????????????? headers={"User-Agent":"Mozilla/5.0"})???? html = BeautifulSoup(raw.text, 'html.parser')????? books = html.select("div.lst_thum_wrap li")???? for b in books:???????? title = b.select_one("a strong").text???????? author = b.select_one("span.writer").text????????? print(title, author)????????? sheet.append([title, author])?wb.save("naverebook.xlsx")?????C:\Users\home\AppData\Local\Programs\Python\Python38\python.exe C:/Users/home/PycharmProjects/_coala_study/hw.py?? File "C:/Users/home/PycharmProjects/_coala_study/hw.py", line 9???? sheet.append(["??","??"])????????? ^?SyntaxError: invalid character in identifier?Process finished with exit code 1????<???? 2>??import requests?from bs4 import BeautifulSoup??f = open("news.csv", "w")???f.write("??,??\n")??for n in range(1, 4):???? raw = requests.get(""+str(n))???? html = BeautifulSoup(raw.text, 'html.parser')????? jour = html.select("div.wrap_cont")????? for j in jour:???????? title = j.select_one("a.f_link_b").text???????? content = j.select_one("p.f_eb.desc").text????????? print(title)???????? print(content)???????? print("="*50)????????? title = title.replace(",", "")???????? content = content.replace(",", "")?????????? f.write(title + "," + content + "\n")??f.close()?????????C:\Users\home\AppData\Local\Programs\Python\Python38\python.exe C:/Users/home/PycharmProjects/_coala_study/hw.py?? File "C:/Users/home/PycharmProjects/_coala_study/hw.py", line 12???? jour= html.select("div.wrap_cont")???????? ^?SyntaxError: invalid character in identifier?Process finished with exit code 1????? ????? ? ??? ?? ?? ??? ???.. ??????? ???? ?? ?? ?????..???? ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download