pinicTable
def printTable(dic_name,l_length,r_length): print('ITEM TABLE'.center(l_length+r_length,"-")) for k,v in dic_name.items(): print(str(k).ljust(l_length,'.')+str(v).rjust(r_length,' '))#填充内容至少为一个character,不能用'',应该输入一个space picnicItems={'apple':12,'pear':20,'strawberry':30,'cookies':50} printTable(picnicItems,12,15) printTable(picnicItems,16,18)