Re: A fun python CLI program for all to enjoy!

2016-05-07 Thread Peter Otten
DFS wrote: > getAddresses.py > > Scrapes addresses from www.usdirectory.com and stores them in a SQLite > database, or writes them to text files for mailing labels, etc > > Now, just by typing 'fast food Taco Bell 10 db all' you can find > out how many Taco Bells are within 10 miles of you,

Re: A fun python CLI program for all to enjoy!

2016-05-07 Thread alister
On Sat, 07 May 2016 18:24:45 +1200, Gregory Ewing wrote: > DFS wrote: >> Maybe it worked because the last time the file was written to was in a >> for loop, so I got lucky and the files weren't truncated? Don't know. > > It "works" because CPython disposes of objects as soon as they are not >

Re: A fun python CLI program for all to enjoy!

2016-05-07 Thread Gregory Ewing
DFS wrote: Maybe it worked because the last time the file was written to was in a for loop, so I got lucky and the files weren't truncated? Don't know. It "works" because CPython disposes of objects as soon as they are not referenced anywhere. Other implementations of Python (e.g. Jython,

Re: A fun python CLI program for all to enjoy!

2016-05-07 Thread Stephen Hansen
On Fri, May 6, 2016, at 04:58 PM, DFS wrote: > Improper f.close didn't seem to affect any of the files my program wrote > - and I checked a lot of them when I was writing the code. To be clear, its not an "improper" f.close. That command is simply not closing the file. Period. "f.close" is how

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread MRAB
On 2016-05-07 00:58, DFS wrote: On 5/6/2016 7:29 PM, Ethan Furman wrote: On 05/06/2016 04:12 PM, DFS wrote: On 5/6/2016 4:30 PM, MRAB wrote: If you don't want to use the 'with' statement, note that closing the file is: f.close() It needs the "()"! I used close() in 1

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread DFS
On 5/6/2016 7:29 PM, Ethan Furman wrote: On 05/06/2016 04:12 PM, DFS wrote: On 5/6/2016 4:30 PM, MRAB wrote: If you don't want to use the 'with' statement, note that closing the file is: f.close() It needs the "()"! I used close() in 1 place, but close without parens in

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread Ethan Furman
On 05/06/2016 04:12 PM, DFS wrote: On 5/6/2016 4:30 PM, MRAB wrote: If you don't want to use the 'with' statement, note that closing the file is: f.close() It needs the "()"! I used close() in 1 place, but close without parens in 2 other places. So it works either way.

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread DFS
On 5/6/2016 4:30 PM, MRAB wrote: On 2016-05-06 20:10, DFS wrote: getAddresses.py Scrapes addresses from www.usdirectory.com and stores them in a SQLite database, or writes them to text files for mailing labels, etc Now, just by typing 'fast food Taco Bell 10 db all' you can find out how many

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread MRAB
On 2016-05-06 20:10, DFS wrote: getAddresses.py Scrapes addresses from www.usdirectory.com and stores them in a SQLite database, or writes them to text files for mailing labels, etc Now, just by typing 'fast food Taco Bell 10 db all' you can find out how many Taco Bells are within 10 miles of

A fun python CLI program for all to enjoy!

2016-05-06 Thread DFS
getAddresses.py Scrapes addresses from www.usdirectory.com and stores them in a SQLite database, or writes them to text files for mailing labels, etc Now, just by typing 'fast food Taco Bell 10 db all' you can find out how many Taco Bells are within 10 miles of you, and store all the