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.
如何格式化十进制数?
我有amount = 55.6。
amount = 55.6
是否有可以在一行中完成的快速格式,所以输出是"55.60"?
"55.60"
"%.2f" % amount #=> "55.60"
希望这可以帮助。