How pthon flask web formats dictionary data

flask returns the following dictionary:

{"DiscountID": "1189048", "Value": "20.0000", "BeginDate": "2018-07-28", "EndDate": "2018-09-28"}

the 20.0000 above has four zeros, and there are also four zeros when using {% for x in dict%}. How to format it so as not to display four zeros? jinjia2"s filter has tried, but because this 20.0000 is a string, no valid method has been found, please give me some advice, thank you! ~
now returns something like this

  • 1189048
  • 20.0000
  • 2018-07-28
  • 2018-09-28

want to do this

  • 1189048
  • 20
  • 2018-07-28
  • 2018-09-28
Mar.30,2021

jinja2 syntax has a function-- round (value,precision=0,method='common') : rounding operation, accepting a value, precision represents precision (keep a few digits after the decimal point) , method can take the value common | ceil | floor, represents rounding | rounding | rounding.

Menu