Appending data to a json file

Michael Torrie torriem at gmail.com
Tue Apr 4 10:17:57 EDT 2017


On 04/03/2017 11:31 PM, dieter wrote:
> Dave <dboland9 at fastmail.fm> writes:
> 
>> I created a python program that gets data from a user, stores the data
>> as a dictionary in a list of dictionaries.  When the program quits, it
>> saves the data file.  My desire is to append the new data to the
>> existing data file as is done with purely text files.
> 
> Usually, you cannot do that:
> "JSON" stands for "JavaScript Object Notation": 

That's assuming he's using JSON; he never specified what he's using to
represent data as plain text.  Though I suspect you're correct, for all
we know he could just be writing data using his own text representation
or writing to an ini file.  And in his case it sounds like JSON is not
an ideal method for saving his data since he's wanting to only append
data, not read it in his program.

In the future, Dave, please provide all the information pertaining to
the problem so we can give accurate advice. Don't make us guess or
assume we can all infer this information.




More information about the Python-list mailing list