Python various types of conversions
Studied: 7920400
8547818
int (x [, Base]) converts x to an integer long (x [, Base]) converts X to a long integer, float (x) converts x to a floating-point number complex (real [, IMAG]) create a complex str (x) to convert object x to String repr (x) to convert object x to expression string eval (str) Used to calculate a valid Python expression in a string, and returns an object tuple (s) converts the sequence s to a tuple list (s) to convert the sequence s to a listing chr (x) Converts an integer to a character UNICHR (x) converts an integer to a Unicode character, Ord (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
String str converted to Int:int_value = Int (str_value) int converted to string str:str_value = str (int_value) int, unicode:unicode (int_value) Unicode-Int:int (unicode_value) str, unicode:unicode (str_value) Unicode, STR:STR (unicode_value) int STR:STR (int_value) str, int:int (str_value)
Python various types of conversions