如何知道Unicode标识符是否有效?

时间:2013-10-09 17:51:42

标签: python unicode python-3.x

以下是一个示例场景 -

>>> এক = 1
>>> ১ = 1
  File "<stdin>", line 1
    ১ = 1
      ^
SyntaxError: invalid character in identifier

我是从默认的python3解释器运行的。为什么第一个unicode字符串作为标识符而不是第二个?

1 个答案:

答案 0 :(得分:2)

有效标识符在Python 3文档中进行了解释:Lexical analysis - Identifiers and keywords

具体细节可在PEP 3131中找到。