Name

int()

Examples
# Convert floating point number             
f = 65.8                                 
i = int(f)                                  
print(f) # Prints 65
																						
# Convert from string                       
s = "1234"                                  
i = int(s)                                  
print(i) # Prints 1234
																						
# Convert from string with base             
s = "1234"                                  
i = int(s, 16) # base 16 (hexidecimal)   
print(i) # Prints "4660" 
Description Converts a non-integer type (such as a floating-point number or string) to its integer representation.
Syntax
	int(value)
int(value, base)
Parameters
valuethe value to convert to an integer
baseif value is a string, the base to perform the conversion in
Updated on Tue Jul 11 06:52:23 2017.
Creative Commons License