# encoding: utf-8 import csv d1 = {'banana':3,'apple':4,'pear':1,'orange':2} d2 = {'banana':3,'orange':2} d3 = {} d4 = {'apple':4,'banana':3,'pear':1,'orange':2} headers = ['banana', 'apple','pear','orange'] datas = [d1,d2,d3,d4] #newline=''避免出现空行 wi…