Python&统一 [英] Python & unicode
问题描述
嗨!
如果Python使用Unicode,为什么下一个脚本不运行?
# - * - 编码:utf-8 - * -
def ??DμD?D?D?(toto):
返回(toto * 3)
aret = ??DμD?D?D?(4)
@ -salutations
-
Michel Claveau
Hi !
If Python is Ok with Unicode, why the next script not run ?
# -*- coding: utf-8 -*-
def ??DμD?D?D?(toto):
return(toto*3)
aret = ??DμD?D?D?(4)
@-salutations
--
Michel Claveau
推荐答案
因为Python脚本无法正常工作
除了字符串文字的
内容外,
必须是ASCII格式。有一个函数
名称除了ASCII之外不支持
。
John Roth
Michel Claveau - 抽象m ?? ta-galactique non triviale en fuite
perp ?? tuelle。 < un ************ @ msupprimerlepoint.claveauPOINTco m>写在
消息新闻:41 ********************** @ news.wanadoo.fr ...
嗨!
如果Python使用Unicode,为什么下一个脚本没有运行?
# - * - 编码:utf-8 - * -
def ??DμD?D?D?(toto):
返回(toto * 3)
aret = ??DμD?D?D?(4)
@ -salutations
-
Michel Claveau
It doesn''t work because Python scripts
must be in ASCII except for the
contents of string literals. Having a function
name in anything but ASCII isn''t
supported.
John Roth
"Michel Claveau - abstraction m??ta-galactique non triviale en fuite
perp??tuelle." <un************@msupprimerlepoint.claveauPOINTco m> wrote in
message news:41**********************@news.wanadoo.fr...
Hi !
If Python is Ok with Unicode, why the next script not run ?
# -*- coding: utf-8 -*-
def ??DμD?D?D?(toto):
return(toto*3)
aret = ??DμD?D?D?(4)
@-salutations
--
Michel Claveau
John Roth写道:
John Roth wrote:
它不起作用,因为除了
字符串文字的内容外,Python脚本必须是ASCII。在任何东西都有一个函数名,但是不支持ASCII。
It doesn''t work because Python scripts must be in ASCII except for
the contents of string literals. Having a function name in anything
but ASCII isn''t supported.
要选择一点,标识符可以是Unicode;他们只是
仅限于数字和普通的拉丁字母。
To nit-pick a bit, identifiers can be in Unicode; they''re simply
confined to digits and plain Latin letters.
嗨!
和普通拉丁字母
但不是所有字母(否) :éà?àê??等等。)因此,Python对Unicode的支持是有限的。
b晚安
-
Michel Claveau
But not all letters (no : é à ? à ê ? ? etc.)
Therefore, the Python''s support of Unicode is... limited.
Good night
--
Michel Claveau
这篇关于Python&统一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!