python2:  

 

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 33: 

解决办法:

在报错的页面添加代码: import sys 
reload(sys) 
sys.setdefaultencoding('utf8') 

 

 

 

python 3:

open函数可以带参数。

fp=open("index.html",encoding= 'utf-8')

 

相关文章:

  • 2022-01-12
  • 2021-10-31
  • 2021-06-11
  • 2021-10-20
  • 2021-06-05
  • 2021-08-17
  • 2021-11-01
猜你喜欢
  • 2022-01-03
  • 2021-07-09
  • 2021-05-29
  • 2021-10-21
  • 2021-08-19
  • 2022-12-23
  • 2021-06-18
相关资源
相似解决方案