UnicodeDecodeError: 'utf-8'錯誤
1.執行代碼
#!/usr/bin/python
import urllib.request;
# 打開網頁
response = urllib.request.urlopen('http://www.680.com/gongsi/477139.html');
# 輸出頁面內容
print(response.read().decode('utf-8'));
2.報錯截圖
3.解決辦法,修改代碼decode('uft-8','ignore')
#!/usr/bin/python
import urllib.request;
# 打開網頁
response = urllib.request.urlopen('http://www.680.com/gongsi/477139.html');
# 輸出頁面內容
print(response.read().decode('utf-8','ignore'));