Python Jupiter laptop list Remove certain elements

Asked 2 years ago, Updated 2 years ago, 60 views

I am a beginner in coding who is studying coding. I want to use Jupiter's laptop to get Naver's real-time game search word

I want to delete the '' part of the result. I tried using remove and split, but there is an error that the list cannot use both. I'm curious about the solution. And I would appreciate it if you could let me know if there is anything strange about my code.

python jupyter-notebook list

2022-09-20 20:06

1 Answers

import requests
from bs4 import BeautifulSoup as bs

r = requests.get('https://search.naver.com/search.naver?sm=tab_hty&where=nexearch&query=').text
s = bs(r,'html.parser')
rank = s.find('ol', {'class':'lst_realtime_srch'})
data = []
for i in rank.find_all('li'):
    data.append(i.text)
print(data)

Before you study crawling, learn about robots.txt... Study hard


2022-09-20 20:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.