I'm a beginner at Python. ;;
;;;;I received data from two places through API and coded it with Python.
One of them is a string as shown {"A":"TEST", "B": 121212.146466}
One place is a dictionary as shown below {'A': '121212.12356, 'B': '343434.12335}
Your response has been received.
I'd like to remove a thousand commas and decimals so that only the numbers look good.
No matter how much I search on the Internet, the question below matches my intention the most, but I don't know the answer.
https://stackoverflow.com/questions/17489353/printing-a-mixed-type-dictionary-with-format-in-python
Masters, please.
python dictionary formatting
If it is the example below, I think you can do it yourself.
A = {"A":"test", "B": 121212.146466}
For k, vin A.items(): // The result of the items is tuple and cannot be modified
if isinstance(v, float):
A[k] = "{:,}".format(int(v))
# the value of A
{'A': 'test', 'B': '121,212'}
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
911 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
578 Understanding How to Configure Google API Key
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.