Import requests # import request requests Library # Baidu page transmission request to acquire the response object Response = requests.get (URL = ' https://www.baidu.com/ ' ) # Set. 8-character encoding UTF response.encoding = ' UTF-. 8 ' # printing text in response Print (response.text) # the local response text written with Open ( ' baidu.html ' , ' W ' , encoding = ' UTF-. 8 ' ) AS F: f.write ( response.text)