Wednesday, June 24, 2009

python - simple casting

# string to int 
a = int("22")
 
# string to float 
a = float("22")
 
# int to string 
a = str(22)
 
# int to float 
a = float(22)
 
#float to string 
a = str(22.0)
 
#float to int 
a = int(22.0)
 

No comments:

Post a Comment