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)
作者 铁血 汉子 2018年5月15日
2024/12/22/07:06:37am 2018/5/15/1:34:27
0 1739