当前位置:网站首页>Web page Chinese display (print, etc.) GBK error, solution, software

Web page Chinese display (print, etc.) GBK error, solution, software

2022-07-05 07:28:00 work-harder

background

  • When Chinese web pages are displayed , The Chinese display is abnormal ( Not in Chinese )
  • Specific view https://editor.csdn.net/md/?articleId=109079157

terms of settlement

  • see https://editor.csdn.net/md/?articleId=109079157
  • New way : To be sinicized sublime text 4, You don't need the method mentioned in the above link , It can be displayed directly .
#
#  test sublime text  Whether the lower module works normally 
#  among , Chinese display does not need to import other modules , Or special treatment 
#  this sublime text  Chinese version 
#  The following can operate normally 、 Show 

from bs4 import BeautifulSoup
from urllib.request import urlopen

print('Chinese input and display:', ' Hello ')

url='http://www.baidu.com'
html = urlopen(url)
soup = BeautifulSoup(html, 'lxml')
print(soup.prettify())
原网站

版权声明
本文为[work-harder]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140555475908.html