Home > Article > Backend Development > How to perform data type conversion in python
Data type conversion in python is implemented using some functions, such as
Convert x to an integer
int(x [,base ])
Convert x to a long integer
long(x [,base ])
Convert x to a floating point number
float(x )
Create a complex number
complex(real [,imag ])
Convert object x to a string
str(x )
Converts object Tuple
repr(x )
Convert sequence s to a list
eval(str )
Convert an integer to a character
tuple(s )
Convert an integer to a Unicode character
list(s )
Convert a character to its integer value
chr(x )
The above is the detailed content of How to perform data type conversion in python. For more information, please follow other related articles on the PHP Chinese website!