1 概述
#将 78 赋值给变量 nn = 78print(n)print( type(n) )#给x赋值一个很大的整数x = 8888888888888888888888print(x)print( type(x) )#给y赋值一个很小的整数y = -7777777777777777777777print(y)print( type(y) )# 运行结果:78<class 'int'>8888888888888888888888<class 'int'>-7777777777777777777777<class 'int'>
2 关于 Python 2.x
78<type 'int'>8888888888888888888888<type 'long'>-7777777777777777777777<type 'long'>
3 整数的不同进制
http://m.biancheng.net/view/1724.html
http://m.biancheng.net/view/1725.html
#十六进制hex1 = 0x45hex2 = 0x4Afprint("hex1Value: ", hex1)print("hex2Value: ", hex2)#二进制bin1 = 0b101print('bin1Value: ', bin1)bin2 = 0B110print('bin2Value: ', bin2)#八进制oct1 = 0o26print('oct1Value: ', oct1)oct2 = 0O41print('oct2Value: ', oct2)
hex1Value: 69hex2Value: 1199bin1Value: 5bin2Value: 6oct1Value: 22oct2Value: 33
4 数字分隔符
click = 1_301_547distance = 384_000_000print("Python教程阅读量:", click)print("地球和月球的距离:", distance)
Python教程阅读量:1301547地球和月球的距离:384000000
https://blog.csdn.net/weixin_44237659?spm=1011.2124.3001.5343
最后修改时间:2022-09-13 10:57:59
文章转载自微思研,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




