**本次学习主要已Python3为主
六个标准数据类型:Number,String,List,Tuple,Set,Dictionary
不可变数据:Number,String,Tuple
可变数据:List,Set,Dictionary
Number(数字)
支持 int,float,bool,complex(复数)
注意:这里的int 表示为长整型,没有python2中的long
a 可以用type() 或 isinstance来查询变量所指的对象类型
两个函数的区别在于:
>>>a = 10
>>>print(type(a))
<class ‘int‘>
>>>isinstance(a,int)
True
b 删除对象
>>>var1 = 1
>>>del var1
c 数值运算
String(字符串)
使用单引号或者双引号括起来,同时使用反斜杠\ 转义特殊字符
a 字符串截取
b 转义字符\
使用反斜杠转义特殊字符,如不想反斜杠发送转义,可以在字符串前面加上r,表示原始字符串
>>>print(‘ab\nc‘)
ab
c
>>>print(r‘ab\nc‘)
ab\c
反斜杠还可作为续行符,表示下一行是上一行的延续。也可以使用“”“...""" 或者‘‘‘...‘‘‘多行
注意:
文章内容参考:https://www.runoob.com/python3/python3-data-type.html
原文:https://www.cnblogs.com/amy720/p/11463564.html