>>> a = "545.2222"
>>> float(a)
545.22220000000004
>>> int(float(a))
545
More Related Contents:
- How do I get 4 instead of 4.0 in "Squirrels and nuts – 1" task? [closed]
- How can I force division to be floating point? Division keeps rounding down to 0?
- How do I check if a string is a number (float)?
- How do you round UP a number?
- Convert floats to ints in Pandas?
- Call int() function on every list element?
- Convert Python strings into floats explicitly using the comma or the point as separators
- Converting integer to digit list
- How to manage division of huge numbers in Python?
- How do I check if a string represents a number (float or int)?
- Is there a built-in or more Pythonic way to try to parse a string to an integer
- Python “safe” eval (string to bool/int/float/None/string)
- Round a floating-point number down to the nearest integer?
- Convert a Unicode string to a string in Python (containing extra symbols)
- The `is` operator behaves unexpectedly with non-cached integers
- How to extract multiple JSON objects from one file?
- Format floats with standard json module
- Range values to pseudocolor
- Convert integer to string in Python
- Safest way to convert float to integer in python?
- How to read specific part of large file in Python
- pandas read_html ValueError: No tables found
- Parsing a YAML file in Python, and accessing the data?
- Converting a string that represents a list, into an actual list object
- Convert all strings in a list to integers
- Python floating point number comparison
- How does python and the regex module handle backslashes?
- How to get largest possible precision? (Python – Decimal)
- Parsing a date that can be in several formats in python
- How do you get the next value in the floating-point sequence? [duplicate]