Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试转换,例如:
0.00282357936911 to 2.82e-03 and 0.000130076846614 to 1.30e-04
但是,当我使用 filter 时{{ data|stringformat:"e" }},我得到
{{ data|stringformat:"e" }}
2.823579e-03 and 1.300768e-04
有没有办法四舍五入到小数点后两位? 提前谢谢了。
您可以使用:
{{ data|stringformat:".2e" }}
.<number>语法指定小数点数。有关更多信息,请参阅参考。
.<number>