Python整型运算之布尔型、标准整型、长整型操作示例


Posted in Python onJuly 21, 2017

本文实例讲述了Python整型运算之布尔型、标准整型、长整型操作。分享给大家供大家参考,具体如下:

#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()

运行结果如下图:

Python整型运算之布尔型、标准整型、长整型操作示例

PS:这里再为大家推荐几款计算工具供大家进一步参考借鉴:

在线一元函数(方程)求解计算工具:
http://tools.3water.com/jisuanqi/equ_jisuanqi

科学计算器在线使用_高级计算器在线计算:
http://tools.3water.com/jisuanqi/jsqkexue

在线计算器_标准计算器:
http://tools.3water.com/jisuanqi/jsq

希望本文所述对大家Python程序设计有所帮助。

Python 相关文章推荐
python使用cookielib库示例分享
Mar 03 Python
Python2随机数列生成器简单实例
Sep 04 Python
Python反转序列的方法实例分析
Mar 21 Python
python创建文件时去掉非法字符的方法
Oct 31 Python
pip指定python位置安装软件包的方法
Jul 12 Python
Pandas之groupby( )用法笔记小结
Jul 23 Python
Pytorch反向求导更新网络参数的方法
Aug 17 Python
python爬虫之爬取百度音乐的实现方法
Aug 24 Python
Python元组 tuple的概念与基本操作详解【定义、创建、访问、计数、推导式等】
Oct 30 Python
python DataFrame转dict字典过程详解
Dec 26 Python
Python读取表格类型文件代码实例
Feb 17 Python
python中return如何写
Jun 18 Python
Python双精度浮点数运算并分行显示操作示例
Jul 21 #Python
详解Golang 与python中的字符串反转
Jul 21 #Python
Python随机生成手机号、数字的方法详解
Jul 21 #Python
Python实现将16进制字符串转化为ascii字符的方法分析
Jul 21 #Python
windows下Python实现将pdf文件转化为png格式图片的方法
Jul 21 #Python
python僵尸进程产生的原因
Jul 21 #Python
python下载图片实现方法(超简单)
Jul 21 #Python
You might like
Zerg建筑一览
2020/03/14 星际争霸
又一个小巧的图片预加载类
2007/05/05 Javascript
js 判断 enter 事件
2009/02/12 Javascript
Extjs 继承Ext.data.Store不起作用原因分析及解决
2013/04/15 Javascript
JavaScript页面模板库handlebars的简单用法
2015/03/02 Javascript
jQuery点击按钮弹出遮罩层且内容居中特效
2015/12/14 Javascript
vue日期组件 支持vue1.0和2.0
2017/01/09 Javascript
基于Nodejs利用socket.io实现多人聊天室
2017/02/22 NodeJs
jQuery Position方法使用和兼容性
2017/08/23 jQuery
Vue.js通用应用框架-Nuxt.js的上手教程
2017/12/25 Javascript
AngularJS基于http请求实现下载php生成的excel文件功能示例
2018/01/23 Javascript
利用Blob进行文件上传的完整步骤
2018/08/02 Javascript
jQuery 实现批量提交表格多行数据的方法
2018/08/09 jQuery
jQuery-Citys省市区三级菜单联动插件使用详解
2019/07/26 jQuery
JavaScript实现随机五位数验证码
2019/09/27 Javascript
JS面向对象编程实现的拖拽功能案例详解
2020/03/03 Javascript
vue-cli4.x创建企业级项目的方法步骤
2020/06/18 Javascript
Python中列表和元组的使用方法和区别详解
2020/12/30 Python
Python2和Python3中print的用法示例总结
2017/10/25 Python
对python函数签名的方法详解
2019/01/22 Python
Python Selenium模块安装使用教程详解
2020/07/09 Python
Python web框架(django,flask)实现mysql数据库读写分离的示例
2020/11/18 Python
python实现杨辉三角的几种方法代码实例
2021/03/02 Python
详解CSS3中强大的filter(滤镜)属性
2017/06/29 HTML / CSS
boostrap modal 闪现问题的解决方法
2020/09/01 HTML / CSS
香港个人化生活购物网站:Ballyhoo Limited
2016/09/10 全球购物
好莱坞百老汇御用王牌美妆:Koh Gen Do 江原道
2018/04/03 全球购物
英国家庭和商业健身器材购物网站:Fitness Options
2018/07/05 全球购物
爸爸的花儿落了教学反思
2014/02/20 职场文书
爱国卫生月实施方案
2014/02/21 职场文书
开展批评与自我批评发言材料
2014/05/15 职场文书
投标人法定代表人授权委托书格式
2014/09/28 职场文书
团结主题班会
2015/08/13 职场文书
python基于scrapy爬取京东笔记本电脑数据并进行简单处理和分析
2021/04/14 Python
使用Python脚本对GiteePages进行一键部署的使用说明
2021/05/27 Python
centos7安装mysql5.7经验记录
2022/05/02 Servers