1

How could I compare two strings which are actually floating numbers? Something like "0.1234" < "0.2345". Unfortunately, I can't use float on the strings since this function does not exist in jinja.

The problem that I try to solve is that I want to present only values above a threshold.

4

2 回答 2

4

Use {{ var1|float() < var2|float()}}

http://jinja.pocoo.org/docs/2.9/templates/#float

于 2017-05-16T22:53:45.377 回答
-1

I solved the problem by returning a float from the server. Then, comparison works as expected.

于 2012-11-16T09:23:35.510 回答