返回顶部

收藏

zfill(): pads a numeric string on the left with zeros

更多
# It understands about plus and minus signs:

print '12'.zfill(5)

print '-3.14'.zfill(7)

print '3.14159265359'.zfill(5)

# Using the % operator looks like this:

import math
print 'The value of PI is approximately %5.3f.' % math.pi

标签:Python,Buildin,Function

收藏

0人收藏

支持

0

反对

0