import requests # socket-->http-->requests response=requests.get('https://tieba.baidu.com/f?kw=%E6%B5%81%E6%B5%AA%E6%B1%89') print(response.text) with open('12.html','w+',encoding='utf8')as f: f.write(response.text)