import pandas as pd# read filecol_names = ['id','col1','col2']dic = {} # your datadataframe = pd.DataFrame(dic)dataframe.to_csv(new_file, index=False, columns=cols)