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) | ||||
Parameters |
|
Updated on Mon Sep 21 15:53:25 2020.
If you see any errors or have comments, please let us know.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License