使用变量'frame'作为输入,根据列中的数据为每一行打印行
frame = {'kind of pet': ['dogs', 'cats', 'gerbils', 'geese'],
'number of pets': [10, 20, 5, 4]}
我希望输出看起来像
狗10 猫20 沙鼠5 鹅4
答案 0 :(得分:0)
您可以这样做
for a,b, in zip(frame['kind of pet'],frame['number of pets']):
print("{} {}".format(b,a))
在python 3.x +上使用f字符串以提高可读性