Summary of some type conversion functions in python
- 2020-04-02 09:45:52
- OfStack
function
describe
Int x [, base]) Convert x to an integer
Long (x [, base]) Convert x to a long integer
Float (x) Converts x to a floating point number
The complex (real) [, imag] Create a complex number
STR (x) Converts the object x to a string
Repr (x) Converts the object x to an expression string
The eval (STR) Used to evaluate a valid Python expression in a string and return an object
The tuple (s) Converts the sequence s to a tuple
The list (s) Converts the sequence s to a list
CRH (x) Converts an integer to a character
Unichr (x) Converts an integer to a Unicode character
Word (x) Converts a character to its integer value
Hex (x) Converts an integer to a hexadecimal string
Oct (x) Converts an integer to an octal string
Int x [, base]) Convert x to an integer
Long (x [, base]) Convert x to a long integer
Float (x) Converts x to a floating point number
The complex (real) [, imag] Create a complex number
STR (x) Converts the object x to a string
Repr (x) Converts the object x to an expression string
The eval (STR) Used to evaluate a valid Python expression in a string and return an object
The tuple (s) Converts the sequence s to a tuple
The list (s) Converts the sequence s to a list
CRH (x) Converts an integer to a character
Unichr (x) Converts an integer to a Unicode character
Word (x) Converts a character to its integer value
Hex (x) Converts an integer to a hexadecimal string
Oct (x) Converts an integer to an octal string