help with lists and writing to file in correct order

Scott David Daniels scott.daniels at
Tue Dec 27 05:23:42 CET 2005

homepricemaps at wrote:
> the problem with writing to teh file immidiately is that it ends up
> writing all food items together, and then all store items and then all
> prices
> i want
> food, store, price
> food, store, price
Well, if it all fits in memory, append each to its own list, and then
either finally if you can or periodically if you must:

     for food, store, price in zip(foods, stores, prices):
         <do some writing.>

-Scott David Daniels
scott.daniels at

More information about the Python-list mailing list