Actually, you could still use the round function:
>>> print round(1123.456789, -1)
1120.0
This would round to the closest multiple of 10. To 100 would be -2 as the second argument and so forth.
More Related Contents:
- How to insert a space delimited text file into mysql using Python? [closed]
- Circular (or cyclic) imports in Python
- Convert regular Python string to raw string
- How to convert ‘binary string’ to normal string in Python3?
- Regular expression to extract URL from an HTML link
- importing pyspark in python shell
- Cannot install Python 3.7 on osx-arm64
- How do I remove NaN values from a NumPy array?
- How to redirect with post data (Django)
- Normalize columns of a dataframe
- Python Pandas, write DataFrame to fixed-width file (to_fwf?)
- How to get/set local variables of a function (from outside) in Python? [duplicate]
- “In” operator for numpy arrays?
- Read file content from S3 bucket with boto3
- Remove final character from string
- Django – taking values from POST request
- PIP Install Numpy throws an error “ascii codec can’t decode byte 0xe2”
- How to manage division of huge numbers in Python?
- What does ‘u’ mean in a list?
- Continuing in Python’s unittest when an assertion fails
- Screen Capture with OpenCV and Python-2.7
- Why do I get “OverflowError: (34, ‘Result too large’)” or “OverflowError: (34, ‘Numerical result out of range’)” from floating-point exponentiation?
- Keras AttributeError: ‘Sequential’ object has no attribute ‘predict_classes’
- Understanding matplotlib: plt, figure, ax(arr)?
- Converting a Mercurial (hg) repository to Git on Windows (7)
- How to see the real SQL query in Python cursor.execute using pyodbc and MS-Access
- How to run raw mongodb commands from pymongo
- Authentication with Azure Active Directory – how to accept user credentials programmatically
- How to remove repititve pattern from an image using FFT
- Random Python dictionary key, weighted by values