普通python字符串使用什么编码? [英] What encoding do normal python strings use?

查看:120
本文介绍了普通python字符串使用什么编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道django在整个框架上使用unicode字符串,而不是普通的python字符串。普通python字符串使用什么编码?为什么不使用unicode?

解决方案

从Python 3.0开始,所有字符串都是unicode,默认情况下还有字节数据类型(

i know that django uses unicode strings all over the framework instead of normal python strings. what encoding are normal python strings use ? and why don't they use unicode?

From Python 3.0 on all strings are unicode by default, there is also the bytes datatype (Python documentation).

So the python developers think that using unicode is a good idea, that it is not used universally in python 2 is mostly due to backwards compatibility. It also has performance implications.

这篇关于普通python字符串使用什么编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆