'ascii' codec can't decode byte (problem when using django)

后端 未结 2 1653
有刺的猬
有刺的猬 2021-01-27 01:32

I wrote a simple html parsing class in python and it seems to work fine and then I try to use it with django and I get this error:

\'ascii\' codec can\'t decode          


        
相关标签:
2条回答
  • 2021-01-27 02:03

    Try putting that line at the top of your file. According to PEP 263, it has to be in the top two lines.

    0 讨论(0)
  • 2021-01-27 02:05

    okay, I got it. All I needed to do was include # -*- coding: utf-8 -*- in the django view as well and that solved it!

    0 讨论(0)
提交回复
热议问题