import pandas as pd
def writeDataToCSVFile(output_filename, dic_data, keys, para4):
pd_data = pd.DataFrame(dic_data)
pd_data.to_csv(output_filename, index=para4)
data = [{'apno': 'REP-12', 'value': '450'}, {'apno': 'ELEC-72', 'value': '2000'}]
writeDataToCSVFile("sample_header.csv", data, ['value', 'apno'], True)
運行環境python2.7? 有問題歡迎追問?