標準數(shù)據(jù)類型: Numbers(數(shù)字):int bool float complex python2里面還多了一個long Python3沒有 String(字符串) List(列表) Tuple(元組) Sets(集合) Dictionary(字典) 在Python3里,只有一種整數(shù)類型int,表示為長整型 Python3 Numbers(數(shù)字)支持int、float、bool、complex(復數(shù))。 不可變數(shù)據(jù)(3 個):Number(數(shù)字)、String(字符串)、Tuple(元組); 可變數(shù)據(jù)(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 復數(shù)是由x + yj表示的有序?qū)Φ膶崝?shù)浮點數(shù)組成,其中x和y是實數(shù),j是虛數(shù)單位。 分享知識,分享快樂!希望中國站在編程之巔!
|
|