Python data types can be divided into three categories: numeric, sequence, and mapping. There is also the None
object that represents a Null
, or absence of a value. It should not be forgotten either that other objects such as classes, files, and exceptions can also properly be considered types; however, they will not be considered here.
Every value in Python has a data type. Unlike many programming languages, in Python you do not need to explicitly declare the type of a variable. Python keeps track of object types internally.
Python built-in data types are outlined in the following table:
Category | Name | Description |
None |
| The null object. |
Numeric |
| Integer. |
| Floating point number. | |
| Complex number. | |
| Boolean (True, False). | |
Sequences |
| String of characters. |
| List of arbitrary objects. | |
| Group of arbitrary items. | |
| Creates a range of integers. | |
Mapping |
| Dictionary of key-value pairs. |
| Mutable, unordered collection of unique items. | |
| Immutable set. |