Invalid Token when using Octal numbers

后端 未结 1 1313
轻奢々
轻奢々 2020-12-08 18:19

I\'m a beginner in python and I\'m trying to use a octal number in my script, but when I try it, it returns me that error:

>>> a = 010
SyntaxError:          


        
相关标签:
1条回答
  • 2020-12-08 18:55

    Try 0o10, may be because of python 3, or pyshell itself.

    PEP says,

    octal literals must now be specified with a leading "0o" or "0O" instead of "0";

    http://www.python.org/dev/peps/pep-3127/

    0 讨论(0)
提交回复
热议问题