Re: [Tutor] Introduction - log exercise

2009-11-18 Thread Alan Gauld
"bob gailer" wrote "Antonio de la Fuente" wrote > if not line.isspace() and not line == 'foo': > fileOut.write(line) But then, the new log file will have all the blocks, even the ones that had 'foo' on it, even if the foo lines weren't there anymore. No? or is there anything that I don'

[Tutor] python wsgi

2009-11-18 Thread Amit Sethi
Hi , How do I run a python script using wsgi? I am not using any web framework I just wish to try out running a simple script. -- A-M-I-T S|S ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/

Re: [Tutor] Open Source database software

2009-11-18 Thread mjekl
Kent Johnson wrote: On Mon, Nov 24, 2008 at 7:19 PM, Mike Meisner wrote: > 3. A good GUI front end for creating the database, creating forms for user > data input, queries, reports, etc. For this you might look at Dabo: http://dabodev.com/ I haven't worked with it myself but some people

Re: [Tutor] opening a file directly from memory

2009-11-18 Thread mjekl
Humm. Most enlighting. For my case the solution is clearly to have an initialization file. In case the specified extension is not known then I'll prompt the user to save the file and pass on the responsibility. Txs everyone, Miguel _

Re: [Tutor] python wsgi

2009-11-18 Thread Kent Johnson
On Wed, Nov 18, 2009 at 5:11 AM, Amit Sethi wrote: > Hi , > > How do I run a python script using wsgi? I am not using any web > framework I just wish to try out running a simple script. You need to run a WSGI-compliant server and configure it to host your application. The std lib contains a simpl

[Tutor] Faster list searching?

2009-11-18 Thread GoodPotatoes
I'm dealing with bigger lists than I have been, and noticed this is getting really slow. Is there a faster way to do this? for x in list1: if x not in list2: list3.append(x) My search is taking up to 5 minutes to complete. __ Do You

Re: [Tutor] Faster list searching?

2009-11-18 Thread wesley chun
On Wed, Nov 18, 2009 at 1:51 PM, GoodPotatoes wrote: > I'm dealing with bigger lists than I have been, and noticed this is getting > really slow. Is there a faster way to do this? > > for x in list1: > if x not in list2: > list3.append(x) > > My search is taking up to 5 minutes to com

Re: [Tutor] Faster list searching?

2009-11-18 Thread Kent Johnson
On Wed, Nov 18, 2009 at 4:51 PM, GoodPotatoes wrote: > I'm dealing with bigger lists than I have been, and noticed this is getting > really slow.  Is there a faster way to do this? > > for x in list1: >     if x not in list2: >         list3.append(x) > > My search is taking up to 5 minutes to com

Re: [Tutor] Introduction - log exercise

2009-11-18 Thread Antonio de la Fuente
* Christian Witts [2009-11-18 09:53:15 +0200]: > Date: Wed, 18 Nov 2009 09:53:15 +0200 > From: Christian Witts > To: Antonio de la Fuente > CC: Python Tutor mailing list > Subject: Re: [Tutor] Introduction - log exercise > User-Agent: Thunderbird 2.0.0.23 (X11/20090817) > Message-ID: <4b03a7e.

Re: [Tutor] Faster list searching?

2009-11-18 Thread Bill Campbell
On Wed, Nov 18, 2009, GoodPotatoes wrote: >I'm dealing with bigger lists than I have been, and noticed this is getting >really slow. Is there a faster way to do this? > >for x in list1: >if x not in list2: >list3.append(x) > >My search is taking up to 5 minutes to complete. When I ha

Re: [Tutor] Faster list searching?

2009-11-18 Thread Luke Paireepinart
On Wed, Nov 18, 2009 at 5:03 PM, Bill Campbell wrote: > > When I have had to deal with large lists, I have found that using > an intermediate dictionary can save huge amounts of time. > Something like: > > dict2 = {}.fromkeys(list2) > for x in list1: >if x not in dist2: >d

Re: [Tutor] Faster list searching?

2009-11-18 Thread Luke Paireepinart
On Wed, Nov 18, 2009 at 5:54 PM, Luke Paireepinart wrote: > This is really just a round-about way of using sets. > I don't really want to give a code-sample unless he's confirmed he's not > doing this as homework, but the set version is much more simple (shorter > code that makes more sense) and e

Re: [Tutor] Introduction - log exercise

2009-11-18 Thread Antonio de la Fuente
* Antonio de la Fuente [2009-11-17 16:58:08 +]: > Date: Tue, 17 Nov 2009 16:58:08 + > From: Antonio de la Fuente > To: Python Tutor mailing list > Subject: [Tutor] Introduction - log exercise > Organization: (muybien.org) > User-Agent: Mutt/1.5.20 (2009-06-14) > Message-ID: <20091117165

Re: [Tutor] Faster list searching?

2009-11-18 Thread Tim Peters
[Luke Paireepinart] >> This is really just a round-about way of using sets. >> I don't really want to give a code-sample unless he's confirmed he's not >> doing this as homework, but the set version is much more simple (shorter >> code that makes more sense) and extremely quick as well.  If you're

Re: [Tutor] Faster list searching?

2009-11-18 Thread Alan Gauld
"Tim Peters" wrote result = set(list1) - set(list2) Of course the result is a set then. Which means that if there were duplicates in list1 you only get one copy in the result. As Tim says, whether that is good, bad or irrelevant depends on the problem context. Maybe that will work fin

[Tutor] Readable date arithmetic

2009-11-18 Thread Stephen Nelson-Smith
I have the following method: def get_log_dates(the_date_we_want_data_for): t = time.strptime(the_date_we_want_data_for, '%Y%m%d') t2 = datetime.datetime(*t[:-2]) extra_day = datetime.timedelta(days=1) t3 = t2 + extra_day next_log_date = t3.strftime('%Y%m%d') return (the_date_we_want_da

Re: [Tutor] Making http posts

2009-11-18 Thread Rich Lovely
2009/11/5 Kent Johnson : > On Thu, Nov 5, 2009 at 5:06 AM, Stephen Nelson-Smith > wrote: >> Hello, >> >> I want to make an HTTP POST which will require authentication. > > What kind of authentication? Basic auth is easy to use from Python; > form-based auth is a bit tricker. > >> This is because