1.

Does Python support data type conversion ?

Answer»

Yes, Python support data type conversion. To convert between built-in types, programmer simply use the type name as a function. There are several built-in functions to perform conversion from one data type to another. These functions return a new object represting the converted value.

 Function           Description
int (x  [base])Converts x to an integer, base specifies the base if x is a string.
long [x [, base])Converts x to a long integer, base specifies the base if x is a string.
float (x)Converts x to a floatingpoint number.
complex (real, [ing])Creates a complex number.
str (x)Converts object x to a string representation.
repr (x)Converts object x to an expression string.
tuple (x)Converts x to a tuple.
list (x)Converts x to a list.
chr (xConvets an integer to a character.
unichr (x)Converts an integer to a Unicode character.
diet (x)Creates a disetionary, x must be a sequence of tuples.
set (x)Converts x to a set



Discussion

No Comment Found