Pages

Showing posts with label types. Show all posts
Showing posts with label types. Show all posts

Thursday, November 8, 2012

Data types in python

You can use "isinstance" method to check the data type.

You can use "str" and "int" as a method to data type changes.
strint = "32"
if isinstance(strint, str):
    print "String"
    print int(strint)
    
x = 10    
print str(x)
print `x`
print "%d" % x

print int('10')
String
32
10
10
10
10