Python urllib request urlopen request web page returns bytes type

I am learning the urllib library. I use the following code to request the home page of the face degree, and the result is < class" bytes" >. I have tried a variety of methods to decode it, but all of them are unsuccessful (error or null)
the following code:

from urllib import request
f = request.urlopen("http://www.baidu.com/")
print(f.read())
print(type(f.read()))
x = f.read()
print(x.decode(encoding="utf-8"))

the following is the output:
. N < / body > n < / html > nrnrnrnnrn"
< class" bytes" >
"
Please give me your advice, thank you!


the first call to read () returns, and the subsequent calls always return baked'

.

urllib requests

import requests
response = requests.get('https://www.baidu.com/')
response.encoding = 'utf-8'
print(response.text)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30497-4028d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30497-4028d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?