for i in range(024,027):
print i
为什么输出的是
20
21
22
而不是
24
25
26
前面不加 0 却不会报错,怎么破???
print i
为什么输出的是
20
21
22
而不是
24
25
26
前面不加 0 却不会报错,怎么破???
1
siguretto Jul 8, 2017 via iPhone 8 进制
|
2
lzhr Jul 8, 2017
|
3
babywhisper Jul 12, 2017 学会 google 呀,骚年
https://stackoverflow.com/questions/11620151/what-do-numbers-starting-with-0-mean-in-python These are numbers represented in base 8 (octal numbers). For example, 011 is equal to 1*(8**1) + 1*(8**0) = 9, 0100 is equal to 1*(8**2) + 0*(8**1) + 0*(8**0) = 64, 027 is equal to 2*(8**1) + 7*(8**0) = 16 + 7 = 23. |