Using csv DictWriter - add a extra field

Victor Hooi victorhooi at gmail.com
Tue Mar 31 04:41:04 EDT 2015


Hi,

Aha, yeah, I can add the connection_id as another field in the inner dict - the only drawback is that the data is duplicated twice. However, I suppose even if it's not elegant, it does work.

However, that ChainMap does look interesting =). And yes, I am actually using Python 3.x (mainly because of http://bugs.python.org/issue6641).

So if I understand correctly, I can just use ChainMap to join any arbitrary number of dicts together - it seems like the right solution here.

Are there any drawbacks to using ChainMap here? (Aside from needing Python 3.x).

Cheers,
Victor



More information about the Python-list mailing list