Home  >  Article  >  Backend Development  >  How to perform data type conversion in python

How to perform data type conversion in python

silencement
silencementOriginal
2019-06-12 14:12:353287browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn