Re: Appending data to a json file

2017-04-04 Thread MRAB
On 2017-04-04 21:00, Dennis Lee Bieber wrote: On Tue, 4 Apr 2017 13:23:52 -0400, Dave declaimed the following: I don't care for the idea of replacing the data file for every save. My preference would to append to the existing data file - makes more sense. However, that is not how json works.

Re: Appending data to a json file

2017-04-04 Thread Grant Edwards
On 2017-04-04, Ben Finney wrote: > Dave writes: > >> I don't care for the idea of replacing the data file for every save. > > This is the simplest implementation. It works. Can you say why you don't > care for it? After the data is read, it requires reloading the ASR33 with a fresh spool of unpu

Re: Appending data to a json file

2017-04-04 Thread Michael Torrie
On 04/04/2017 11:23 AM, Dave wrote: > I did. Please see the subject - it is json, not some bastardized > version of it. My fault for not seeing that! Sorry about the noise. -- https://mail.python.org/mailman/listinfo/python-list

Re: Appending data to a json file

2017-04-04 Thread Dave
On 04/04/2017 01:50 PM, Rob Gaddi wrote: On 04/04/2017 10:23 AM, Dave wrote: I don't care for the idea of replacing the data file for every save. My preference would to append to the existing data file - makes more sense. However, that is not how json works. So, I'm considering other alternat

Re: Appending data to a json file

2017-04-04 Thread Rob Gaddi
On 04/04/2017 10:23 AM, Dave wrote: I don't care for the idea of replacing the data file for every save. My preference would to append to the existing data file - makes more sense. However, that is not how json works. So, I'm considering other alternatives for a data file structure. Paired da

Re: Appending data to a json file

2017-04-04 Thread Ben Finney
Dave writes: > I don't care for the idea of replacing the data file for every save. This is the simplest implementation. It works. Can you say why you don't care for it? > My preference would to append to the existing data file - makes more > sense. Can you expand on that? You haven't defined

Re: Appending data to a json file

2017-04-04 Thread Dave
On 04/04/2017 10:17 AM, Michael Torrie wrote: On 04/03/2017 11:31 PM, dieter wrote: Dave 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 d

Re: Appending data to a json file

2017-04-04 Thread Robin Koch
Am 04.04.2017 um 04:59 schrieb Dave: 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.

Re: Appending data to a json file

2017-04-04 Thread Michael Torrie
On 04/04/2017 08:19 AM, Jussi Piitulainen wrote: > The clue is on the subject line. Ahh, so it is. -- https://mail.python.org/mailman/listinfo/python-list

Re: Appending data to a json file

2017-04-04 Thread Jussi Piitulainen
Michael Torrie writes: > On 04/03/2017 11:31 PM, dieter wrote: >> Dave 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

Re: Appending data to a json file

2017-04-04 Thread Michael Torrie
On 04/03/2017 11:31 PM, dieter wrote: > Dave 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 i

Re: Appending data to a json file

2017-04-03 Thread Oren Ben-Kiki
You _can_ just extend a JSON file without loading it, but it will not be "fun". Say the JSON file contains a top-level array. The final significant character in it would be a ']'. So, you can read just a reasonably-sized block from the end of the file, find the location of the final ']', overwrite

Re: Appending data to a json file

2017-04-03 Thread dieter
Dave 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 c

Re: Appending data to a json file

2017-04-03 Thread Michael Torrie
On 04/03/2017 08:59 PM, Dave wrote: > 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 tex

Appending data to a json file

2017-04-03 Thread Dave
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. However, I can't find a way to do