Data Type Conversion, Basic Computer Science

Sometimes you may drop to perform conversions among the built-in types. To translate between types you just use the type name as a function.
There are quite a few built-in functions to carry out conversion from one data type to another. These functions return a new object representing the changed value.
Function Description
Converts x to an integer. Base states the base if x is a string.
long(x [,base] ) Converts x to a long integer. Base identifies the base if x is a string.
float(x) Changes x to a floating-point number.
complex(real [,imag]) Generates a complex number.
str(x) Changes object x to a string representation.
repr(x) Changes object x to an expression string.
eval(str) Estimates a string and returns an object.
tuple(s) Changes s to a tuple.
list(s) Changes to a list.
set(s) Translates s to a set.
dict(d) Generates a dictionary. d must be a sequence of (key, value) tuples.
frozenset(s) Translates s to a frozen set.
chr(x) Translates an integer to a character.
unichr(x) Translates an integer to a Unicode character.
ord(x) Translates a single character to its integer value.
hex(x) Translates an integer to a hexadecimal string.
oct(x) Translates an integer to an octal string.
Posted Date: 5/5/2012 3:59:55 AM | Location : United States







Related Discussions:- Data Type Conversion, Assignment Help, Ask Question on Data Type Conversion, Get Answer, Expert's Help, Data Type Conversion Discussions

Write discussion on Data Type Conversion
Your posts are moderated
Related Questions
Question 1 What are the features that Bash shell provides? Question 2 Explain Runlevels Question 3 Discuss the following                           1) Links 2) Doma

ASCII code:  An alphanumeric code has to represent 10 decimal digits, 26 alphabets and certain other symbols such as punctuation marks and special characters. Therefore, a min

Types of Printers 1. Impact printers The impact printers produce the image through a mechanism of striking on the stationary. 2. Line Printer This type of printer

7. Name and explain the action in Conceptual Dependency which refers to a transfer of possession.

online project on hrm i.e index page

The TCP/IP networking protocol suite is so basically named for two of its very most and important protocols: Transmission Control Protocol online tutoring Indication Manage

access,excel and ms word/

The architecture of the x86 processors forces with the use of memory segments to direct the information, the size of these segments is of 64kb. The cause of being of these segments

Ask question #Minimum 100 words accepted/

board coloring