0
点赞
收藏
分享

微信扫一扫

Python爬虫速成之路(1):获取网页源代码

教程内容: 在本教程中,我们将使用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)
举报

相关推荐

0 条评论