# Width and Precision
# d1 = '%5d' % -10
# print(d1)
# d2 = '%5d' % 10
# print(d2)
# dd = '%05d' % -10
# print(dd)
# s = '%.*s' % (3, 'apple')
# print(s)
# from math import pi
# pp = '[%010.2f]' % pi
# print(pp)
# pp2 = '[%-10.2f]' % pi
# print(pp2)
# p = '[%9f]' % pi
# print(p)
# p = '[%5.2f]' % pi
# print(p)
# p = '[%.2f]' % pi
# print(p)
# p = '[%0.2f]' % pi
# print(p)
# priceOfHam = 'Price of ham: $%d' % 42
# print(priceOfHam)
# s = '%s plus %s equals %s' %(1, 1, 2)
# print(s)
# p = "Pi with three decimal: %0.3f"
# from math import pi
# print(p % pi)
댓글 영역