前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Python整型:布尔型、标准整型、长整

Python整型:布尔型、标准整型、长整

作者头像
py3study
发布2020-01-08 18:39:46
1.6K0
发布2020-01-08 18:39:46
举报
文章被收录于专栏:python3python3
代码语言:javascript
复制
#coding=utf8 
def integerType():
    '''
    布尔型:
    该值的取值范围只有两个值:True(1)、False(0)
    '''
    Tbool=True
    Fbool=False
    print "The True is stand for %d" %(Tbool)
    print "The False is stand for %d" %(Fbool)
    print
    '''
    python标准整数类型:
    Python标准整数类型是最通用的数字类型。
    在大多数32位机器上,标准整数类型的取值范围:-2147483648 到 2147483647
    Python标准整数类型等价于C的有符号长整型。
    八进制整数以数字“0”开始。
    十六进制整数以“0x”或“0X”开始    
    '''
    bInt=010101
    dInt=84455555
    oInt=075
    hInt=0xabc
    print "The binary of  the standard integer:",bInt
    print "The decimal of  the standard integer:",dInt
    print "The octal of  the standard integer:",oInt
    print  "The hexadecimal of  the standard integer:",hInt
    print
    '''
    python长整型:
    Python长整型能表达的数值仅仅与机器值的(虚拟)内存大小有关。
    长整数类型是标准整数类型的超集。
    在一个整数值后面加上个L(大写或小写都可以,推荐使用大写,避免和数字1混淆),表示这个整数时长整数。
    这个整数可以是十进制、八进制、十六进制。
    只有对长整数调用repr()才有机会看到L,对长整数调用str()看不到L。   
    整型和长整型正在统一为一种。
    '''
    bLong=0111111111111111111111111111111111111111111111L
    dLong=8888888888888888888888888888888888888888888888L
    oLong=0777777777777777777777777777777777777777777777L
    hLong=0XFFFFFFFFFFFFFFFFFAAAAAAAAAAAAABBBBBBBBBB78L
    
    print "The binary of  the long integer:",repr(bLong)
    print "The decimal of  the long integer:",repr(dLong)
    print "The octal of  the long integer:",repr(oLong)
    print  "The hexadecimal of  the long integer:",repr(hLong)
    print
    
   
'''call  the function : integerType()'''
integerType()
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-09-01 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档