title: Exporting list of pandas dataframes to csv with list comprehension
body: <p>I wrote this list comprehension to export pandas Data Frames to CSV files (each data frame is written to a different file):</p>
  
  <p><code>[v.to_csv(str(k)+'.csv') for k,v in df_dict.items()]</code></p>
  
  <p>The pandas Data Frames are the values of a dictionary where the keys will be the part of the CSV file names. So in the code above <code>v</code> are the Data Frames, and <code>k</code> are strings to which the Data Frames are mapped to.</p>
  
  <p>A colleague said that using list comprehensions is not a good idea for writing to output files. Why would that be? Moreover, he said that using a for loop for this would be more reliable. If true, why is that so?</p>