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
Hello - What is the turn around time for a 6 page website.

The primary step is to start the Debug; this step only consists of typing debug [Enter] on the operative system on time. the "a" (assemble) command is used To assemble a program on

#question.a tree has 0 off springs at each node. if it had a label L, what will be the maximum number of nodes that the tree can have. only an expression involving the number of no

The latest threading module comprised with Python 2.4 provides much more powerful, high-level hold for threads than the old thread module. The threading module depictions all the m

note on high level language and low level language

Question 1 Define Grid computing Question 2 Explain Attribute-Based Programming Model for Grid Services Question 3 What are the characteristics that users/applicat

Bootstrap loader: The critical programs are loaded into memory by the bootstrap loader at start-up time and will remain resident as long as the computer is running. The bootst

They are particular register instructions. They are used to load bytes or sequences of bytes onto a register. LODS (LODSB) (LODSW) LAHF LDS LEA LES LODS (LODSB) (LODSW) INSTRUCTION

Fundamentals of IT 1. How do you insert a symbol in a Word document? 2. Explain absolute cell addressing? 3. Discuss Custom List? 4. Explain applications of Multimedia

Write a shell script, change-lines, which will substitute a string for a replacement string for each occurance of the string in files specified. The original file will be saved,