Python Tutorial

Tuesday, August 17, 2010

python String to integer

'''
   this code is use for convert string to integer
   Check also type of data
'''
data="123"
number=int(data)
print data
print type(data)
print number
print type(number)



Output:
123
< type 'str'>
123
< type 'int' >

0 comments:

Post a Comment