Re: [Tutor] How to output dictionary data to CSV file :p:

2015-04-28 Thread Thomas C. Hicks
On 04/28/2015 09:43 PM, Alan Gauld wrote: You could consider JSON too. JSON looks a lot like a Python dictionary of strings so is almost a perfect match to your data. Sounds great, I'll check it out. Thanks! thomas == Thomas C. Hicks, MD, MPH Training Manager, Gan

Re: [Tutor] How to output dictionary data to CSV file

2015-04-28 Thread Alan Gauld
On 28/04/15 09:51, Paradox wrote: to save that information to a file, CSV seemed the easiest format You could consider JSON too. JSON looks a lot like a Python dictionary of strings so is almost a perfect match to your data. The json module is in the standard library. -- Alan G Author of the

Re: [Tutor] How to output dictionary data to CSV file :p:

2015-04-28 Thread Thomas C. Hicks
On 04/28/2015 05:30 PM, Peter Otten wrote: >>>data = {'B002':'NRP 2014','B003':'HBB 2015'} >>>writer = csv.writer(sys.stdout) >>>writer.writerows(data.items()) B002,NRP 2014 B003,HBB 2015 That is exactly what I was looking for! Thanks, apparently my knowledge deficit is in understanding dict

Re: [Tutor] How to output dictionary data to CSV file

2015-04-28 Thread Peter Otten
Paradox wrote: > I have some data structured like this: > > {'B002':'NRP 2014','B003':'HBB 2015'} > > Basically account numbers and project names, each account number has a > project name. I represent it in a dictionary because that seemed the > best way to keep the account numbers and project

Re: [Tutor] How to output dictionary data to CSV file

2015-04-28 Thread Paradox
How rude of me, I neglected to note I am using Python 3.4.3. On 04/28/2015 04:51 PM, Paradox wrote: I have some data structured like this: {'B002':'NRP 2014','B003':'HBB 2015'} Basically account numbers and project names, each account number has a project name. I represent it in a dictionary