pip install requests pip install bs4 pip install jupyter jupyter notebook
示例
import requests
from bs4 import BeautifulSoup
res = requests.get('http://willless.com/')
res.encoding = 'utf-8'
soup = BeautifulSoup(res.text,'html.parser')
for item in soup.select('.post_item'):
title = item.select('.pt_title')[0].text
time = item.select('.pt_time')[0].text
category = item.select('.pt_category')[0].text
print(title,time,category)
