python:格式化输出,format

xiaoxiao2025-04-20  17

想要输出固定位数,并智能补零

# 共占3位,靠右对齐 "{:3d}".format(5) # 输出: 5 # 共占3位,左侧补零 "{:3d}".format(5) # 输出:005
转载请注明原文地址: https://www.6miu.com/read-5028748.html

最新回复(0)