Python3的数据类型

  Python提供了强大的内置数据类型,以供程序员使用。除非有特殊原因,我们最好总是使用内置类型作为我们的实现方案。内置的数据对象更快更高效,并且经过了大量的验证,不容易出错。

      下面就是Python的内置的数据类型:

数据类型 实例
数字    1111, 123.4, 3+4j ,  0b101 , 0o777 ,  0xff , Decimal() , Fraction()
字符串 'Hello', "Hello", "It's 10", 'He says,"you are nice."',  '''字符长度''' ,"""字符串"""
列表  [1,2, 3, 4] , ['Jan', 'Feb', 'Mar'] ,  
元组 (1, 2, 3, 4) , ('Jan', 'Feb', 'Mar')
字典 { name :'Jack' , phone:'1234' } 
集合 { 'a', 'e' , 'o' ,' i', 'u' } 
文件 open('example.txt')
其它类型 True, False , None 
函数 abs , round , 

猜你喜欢

转载自www.cnblogs.com/gdgdstd/p/9573647.html