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 Tue Feb 27 14:07:12 2024.
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