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.
我有这个工作测试代码:
In [16]: print "{:>20}{:0.2f}".format("", 34) 34.00
但我想只用一个格式的参数来做,我该怎么写?
这是你想要的吗?
>>> print "{:>25.2f}".format(34) 34.00
请注意,我的空间可能与您的空间不同(我拥有的空间与您的示例距离相同)。
这对我来说是这样的: