Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么我在Django中使用str(unicode)成功了?_Django - Fatal编程技术网

为什么我在Django中使用str(unicode)成功了?

为什么我在Django中使用str(unicode)成功了?,django,Django,我知道,我不能直接使用str(unicode),特别是unicode字符串包含中文。但是我成功地使用了str(u'中文') 在Django,和'中文’ 是中国人。它是多么神奇!我想知道它为什么能成功。谁能告诉我呢?我猜Django用在这种情况下更有用的东西取代了标准的str()函数 它可能被自动创建UTF-8的smart_str()()所取代

我知道,我不能直接使用str(unicode),特别是unicode字符串包含中文。但是我成功地使用了str(u'中文') 在Django,和'中文’ 是中国人。它是多么神奇!我想知道它为什么能成功。谁能告诉我呢?

我猜Django用在这种情况下更有用的东西取代了标准的
str()
函数

它可能被自动创建UTF-8的
smart_str()
()所取代