python爬虫 获取网页源代码

import requests

# 获取网页源代码
kv = {'user-agent':'Mozilla/5.0'}       # 请求头信息,相当于一个浏览器面具
html = requests.get('http://tieba.baidu.com/f?ie=utf-8&kw=python&red_tag=g1015520224',headers=kv)
print(html.text)

猜你喜欢

转载自blog.csdn.net/qq_40258748/article/details/87930198