打印好看的整齐的清单
def catalogPrint(content,lwidth,rwidth): print('picnicItems'.center(lwidth+rwidth,'=')) for j,k in content.items(): print(j.ljust(lwidth,'.')+str(k).rjust(rwidth)) picnicItems = {'sandwiches': 4, 'apples': 12, 'cups': 4, 'cookies': 8000} catalogPrint(picnicItems,30,4)
'''
picnicItems 野餐用品清单
===========picnicItems============
sandwiches.................... 4
apples........................ 12
cups.......................... 4
cookies.......................8000