[Tutor] Writing a dictionary to txt file

Alan Gauld alan.gauld at yahoo.co.uk
Sat Aug 29 17:33:34 EDT 2020


On 29/08/2020 18:17, nzbz xx wrote:
> I have a txt file of records that I have converted into a dictionary. How
> can I write this dictionary back to the txt file after appending/replacing
> the values of the dictionary keys?

There are sio many ways to do this that its hard to give advice without
more details.

Do you have a data specification for the output?
What kind of data is stored in the dictionary? It potentially could
be arbitrarily complex and so needs a complex text specification.
But it could just be strings in which case it is nearly trivial.

You need to give us a lot more information before we can give
solid advice.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list