Type Conversions
You will learn how to convert values from one data type to another in Python in this lesson.
We'll cover the following...
Data type conversion functions
To convert a value from one data type to another, it is often possible to use the name of the desired data type as if it were a function. For example:
Conversion | Result |
---|---|
int(5.7) |
5 |
int("5") |
5 |
float(5) |
5.0 |