import requests headers = {"headers头部文件"} url = 'http://www.baidu.com/' html = requests.get(url,headers=headers) html.encoding = 'gbk' #转成该网站的格式 html.text#很重要 print(html.text)