标准数据类型: Numbers(数字):int bool float complex python2里面还多了一个long Python3没有 String(字符串) List(列表) Tuple(元组) Sets(集合) Dictionary(字典) 在Python3里,只有一种整数类型int,表示为长整型 Python3 Numbers(数字)支持int、float、bool、complex(复数)。 不可变数据(3 个):Number(数字)、String(字符串)、Tuple(元组); 可变数据(3 个):List(列表)、Dictionary(字典)、Set(集合)。 #!/usr/bin/python # -*- coding: UTF-8 -*- #赋值 int: counter = 100; float: miles = 1000.0; bool: sex=True; string: name = "John"; word = '字符串'; int float complex 10 0.0 3.14j 100 15.20 45.j -786 -21.9 9.322e-36j 080 32.3+e18 .876j -0490 -90. -.6545+0J -0x260 -32.54e100 3e+26J 0x69 70.2-E12 4.53e-7j 复数是由x + yj表示的有序对的实数浮点数组成,其中x和y是实数,j是虚数单位。 分享知识,分享快乐!希望中国站在编程之巅!
|
|