Do you want to format data from the SQL database with python?
In this case, wouldn't it be possible to simplify the date using the module?
Also, I would like to round off 2.26 and mark it as 2.3%.
Before plastic surgery
[(datetime.date(2016, 7, 17), 2.26268624680273)]
After plastic surgery
Jully 17,2016—2.3% errors
Since you are using Python 3, I think using the format method is the most natural.
The f option also makes it easy to specify the number of decimal places.
ls=[(datetime.date(2016, 7, 17), 2.26268624680273)]
fort, vinls:
print("{}-{:1f}% errors".format(t.strftime("%B%d,%Y"),v))
Note: http://uxmilk.jp/40547
© 2024 OneMinuteCode. All rights reserved.