如何从三个列表(年、动物和销售额)中写入文本文件(outfile.txt)?
years=['2009','2010']
animals=['horse','cat','dog','cow','pig']
sales=[[2,300,700,50,45],[4,9,55,69,88]]
with open ('outfile.txt','w' as outfile):
outfile.write(???
outfile.txt 应如下所示:
animals years_2009 years_2010
horse 2 4
cat 300 9
dog 700 55
cow 50 69
pig 45 88