您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Python Django编码错误,非ASCII字符'\ xe5'

Python Django编码错误,非ASCII字符'\ xe5'

好吧,这里是:

放在# -*- coding: utf-8 -*-文件顶部,它定义解码。

文件说:

如果没有其他编码提示,Python将认使用ASCII作为标准编码。

To define a source code encoding, a magic comment must
be placed into the source files either as first or second
line in the file, such as:

因此,您的代码必须开始:

# -*- coding: utf-8 -*-
from django.shortcuts import render
from django.http import HttpResponse
from django.template.loader import get_template
...

希望有所帮助

python 2022/1/1 18:35:36 有233人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶