Appending data to a json file

Jussi Piitulainen jussi.piitulainen at helsinki.fi
Tue Apr 4 10:19:38 EDT 2017


Michael Torrie writes:

> 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.

The clue is on the subject line.


More information about the Python-list mailing list