Re: [Tutor] data storage question

2016-08-03 Thread Danny Yoo
> Based on both replies I got, JSON is what I will use. > > I do need the keys in the dictionary to be numerals, specifically they are > integers. > > I believe after I load a stored pt_table, I can use this script to convert > the keys back to integers. > > pt_table = dict((int(key), value) for

Re: [Tutor] data storage question

2016-08-03 Thread Colby Christensen
> Date: Tue, 2 Aug 2016 12:14:04 +1000 > From: st...@pearwood.info > To: tutor@python.org > Subject: Re: [Tutor] data storage question > > On Mon, Aug 01, 2016 at 04:47:32PM -0400, Colby Christensen wrote: > >> I'm a no

Re: [Tutor] data storage question

2016-08-01 Thread Danny Yoo
One other thing: you might hear another popular approach is to use the "pickle" module. I don't think it'd be appropriate for your situation because it would be overkill for the problem you're describing. JSON is safer: if you have to choose between JSON and pickle, use JSON. --- More curmudgeo

Re: [Tutor] data storage question

2016-08-01 Thread Danny Yoo
I agree with Steven; JSON is probably one of the most popular formats for saving structured data externally, and it's probably the lightweight approach to use in this situation. By the way, it looks like you're already dealing with a certain file format in your program. In fact, it looks like a s

Re: [Tutor] data storage question

2016-08-01 Thread Steven D'Aprano
On Mon, Aug 01, 2016 at 04:47:32PM -0400, Colby Christensen wrote: > I'm a novice programmer. I have a decent understanding of algorithms > but I don't have a lot of computer science/software engineering > experience. As a way to help me learn, I've begun a coordinate > geometry program similar

[Tutor] data storage question

2016-08-01 Thread Colby Christensen
I'm a novice programmer. I have a decent understanding of algorithms but I don't have a lot of computer science/software engineering experience. As a way to help me learn, I've begun a coordinate geometry program similar to the COGO program developed years ago at MIT. Currently, I store the poin