Python 核心数据类型

时间:2023-01-15 22:59:42

1.Python中一切皆对象

2.Python中不需要申明对象类型,对象的类型由运行的表达式决定

3.创建了对象意味着绑定了对象的操作到此对象,也就是在固有的对象上只能调用该对象特有的操作。比如只能将String操作用在String对象上,list操作用在list对象上。

4.Python内置数据类型:

(1)Number

•  Integer and floating-point objects

• Complex number objects

•  Decimal: fixed-precision objects

•  Fraction: rational number objects

•  Sets: collections with numeric operations

• Booleans: true and false
• Built-in functions and modules: round, math, random, etc.
• Expressions; unlimited integer precision; bitwise operations; hex, octal, and binary
    formats
• Third-party extensions: vectors, libraries, visualization, plotting, etc.

(2)Strings

(3)Lists

(4)Dictionaries

(5)Tuples

(6)Files

(7)Sets

(8)Other core types

(9)Program unit types

(10)Implementation-related types

5.内置数据类型分类:

不可变数据类型(对象一旦创建就不可改变):Numbes,Strings,Tuples,Byte

可变数据类型:Lists,Dictionaries,Bytearrays

序列类型:Strings,Lists

映射类型:Dictionaries