Basic data type...LOGIN

Basic data type conversion

##complex(real [,imag]) Create a complex numberstr(x) Convert object x to stringrepr(x)Convert object x to expression string eval(str) Used to calculate a valid Python expression in a string and return an objecttuple(s )Convert sequence s into a tuplelist(s )Convert sequence s into a listchr(x )Convert an integer to a characterunichr(x ) Convert Convert an integer to a Unicode characterord(x) Convert a character to its integer valuehex (x) Convert an integer to a hexadecimal string
Method Description
int(x [,base ]) Convert x to an integer
float(x )Convert x to a floating point number
oct(x) Convert an integer to an octal string

Note: In Python 3, there is only one The integer type int is expressed as a long integer, and there is no Long in python2.

Next Section
submitReset Code
ChapterCourseware