一、int 整形范围

How Big Is an int?

In Python2, the size of an int was limited to 32 bits, which is enough to store an integer from -2,147,483,648 to 2,147,483,647. A long can store 64 bits. Integers larger than the range will cause Integer Overflow.

In case you wonder where does this range come from. Computers store numbers in its binary format, 32 bits means we have 32 binary bits to store a number. That's why we can only store 232232 different integers. Since we want to store both positive numbers and negative numbers at the same time, each side will get 231231 numbers, which is 2,147,483,648.

In Python3, an int can handle any integer no matter how large it is without causing overflow.

Python3中整形可以用任意大小,不会出现溢出情况。

jupyter notebook中测试如下:

二、Strings 字符串

The strings is a sequence of characters. strings是character组成的序列。

单引号字符串

双引号字符串

转义字符--输出双引号&单引号

转义字符--换行

按照输入格式打印字符串

python基本数据类型和简单用法的更多相关文章

  1. (数据科学学习手札54)Python中retry的简单用法

    一.简介 retry是一个用于错误处理的模块,功能类似try-except,但更加快捷方便,本文就将简单地介绍一下retry的基本用法. 二.基本用法 retry: 作为装饰器进行使用,不传入参数时功 ...

  2. python optparse模块的简单用法

    # coding = utf-8 from optparse import OptionParser from optparse import OptionGroup usage = 'Usage: ...

  3. python之logging模块简单用法

    前言: python引入logging模块,用来记录自己想要的信息.print也可以输入日志,但是logging相对print来说更好控制输出在哪个地方.怎么输出以及控制消息级别来过滤掉那些不需要的信 ...

  4. python中列表的简单用法

    1.定义list >>> li = ["a", "b", "mpilgrim", "z", " ...

  5. python基本数据类型list,tuple,set,dict用法以及遍历方法

    1.list类型 类似于java的list类型,数据集合,可以追加元素与删除元素. 遍历list可以用下标进行遍历,也可以用迭代器遍历list集合 建立list的时候用[]括号 import sys ...

  6. python timeit模块简单用法

    timeit模块提供了一种简便的方法来为Python中的小块代码进行计时. 模块调用函数,stmp为要测试的函数,setup为测试环境,number为运行次数 timeit.timeit(stmt=) ...

  7. python的变量和简单的数据类型

    决定学习python这门语言了,本人资质愚钝,只会把学到的东西记录下来,供自己查漏补缺,也可以分享给和我一样正在学习python语言的人,若在记录中存在什么错误,希望多多批评指正,谢谢. Python ...

  8. python lambda表达式简单用法【转】

    python lambda表达式简单用法 1.lambda是什么? 看个例子: g = lambda x:x+1 看一下执行的结果: g(1) >>>2 g(2) >>& ...

  9. python制作简单excel统计报表2之操作excel的模块openpyxl简单用法

    python制作简单excel统计报表2之操作excel的模块openpyxl简单用法 # coding=utf-8 from openpyxl import Workbook, load_workb ...

随机推荐

  1. CodeForces - 603A-Alternative Thinking (思维题)

    Kevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO ...

  2. 学习flask的网址

    学习flask的网址: http://www.bjhee.com

  3. 泛型设计<T, PK extends Serializable>

    泛型类和泛型方法的使用 http://www.jb51.net/article/67445.htm http://www.cnblogs.com/iyangyuan/archive/2013/04/0 ...

  4. Jmeter4.0----cookie(8)

    1.说明 在脚本编写的过程中,我们常常会遇到用户登录的情况,并且将部分重要信息保存在用户的cookie中,所以,来说一下,对用户登录产生cookie的操作情况. 2.步骤 第一步:添加HTTP Coo ...

  5. (转)CentOS之7与6的区别

    CentOS之7与6的区别 原文:http://www.cnblogs.com/Csir/p/6746667.html http://blog.csdn.net/u012562943/article/ ...

  6. rabbitmq 不发送ack消息如何处理:rabbitmq可靠发送的自动重试机制

    转载地址:http://www.jianshu.com/p/6579e48d18ae http://www.jianshu.com/p/4112d78a8753 接这篇 在上文中,主要实现了可靠模式的 ...

  7. MVC FileResult

    你如何将文件传送给用户取决于你最开始如何存储它,如果你将文件存入数据库,你会用流的方式将文件返还给用户,如果你将文件存在硬盘中,你只需要提供一个超链接即可,或者也可以以流的方式.每当你需要以流的方式将 ...

  8. c#基础 base和this的区别,在继承上面

    base public Person(string name, int age, char gender) { this.Name = name; this.Age = age; this.Gende ...

  9. Java基础语法(练习)

    Java基础语法 今日内容介绍 u 循环练习 u 数组方法练习 第1章 循环练习 1.1 编写程序求 1+3+5+7+……+99 的和值. 题目分析: 通过观察发现,本题目要实现的奇数(范围1-100 ...

  10. AngularJS(五):表单及输入验证

    本文也同步发表在我的公众号“我的天空” 表单基础 表单是HTML中很重要的一个部分,基本上我们的信息录入都依靠表单,接下来我们学习如何在AngularJS中使用表单,首先看以下示例代码: <bo ...