https://google.com/search?q=结果。
import urllibfrom bs4 import BeautifulSoupimport requestsimport webbrowsertext = 'hello world'text = urllib.parse.quote_plus(text)url = 'https://google.com/search?q=' + textresponse = requests.get(url)#with open('output.html', 'wb') as f:# f.write(response.content)#webbrowser.open('output.html')soup = BeautifulSoup(response.text, 'lxml')for g in soup.find_all(class_='g'): print(g.text) print('-----')
阅读美丽汤文档
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)