教程内容: 在本教程中,我们将使用Python编写一个简单的爬虫项目,来爬取指定网页的HTML内容(由于代码过于简单,就不过多解释)
import urllib.request as http
content=http.urlopen('https://www.toutiao.com/').read()
print(content.decode('utf-8'))
优化(推荐):
import requests
response = requests.get('https://www.toutiao.com/')
print(response.text)