[Tutor] strip an email

2005-06-22 Thread nephish
Does anyone know how to strip everything off of an email? i have a little app that i am working on to read an email message and write the body of a message to a log file. each email this address gets is only about three to five lines long. but i cannot seem to get just the body filtered through. i

Re: [Tutor] Refreshing the interpreter environment

2005-06-22 Thread Kent Johnson
Javier Ruere wrote: > lawrence wang wrote: > >>How do I refresh the interpreter environment without restarting it, if >>possible? For example, I'm using the interpreter to test a class I'm >>writing; importing and instantiating it reveals a typo; I go and fix >>the typo. Now, is there any way to r

Re: [Tutor] samples

2005-06-22 Thread Kent Johnson
D. Hartley wrote: > Does anyone have any little "gamelets" like these, or know of > well-documented comparable examples? I'd particularly love some > bejeweled examples, but really, the more "little examples" I can look > through and play with the better off I am. (And yes, I have checked > and

Re: [Tutor] database app

2005-06-22 Thread nephish
Alan G wrote: >>>going on at a time I'd consider moving the database >>>or using snapshot technology or similar, Access locks >>>by pages (default 2K?) which can mean a lot of data >>>rows being locked by a single update. >>> >>> >>> >>ok, another question about this, if i use a snapshot, co

Re: [Tutor] Class vs. Static Methods

2005-06-22 Thread Chuck Allison
Hello Kent, This is the killer example I've been looking for. Now I understand. Sorry I've been so dense. This is way cool. Thanks. Wednesday, June 22, 2005, 4:39:38 AM, you wrote: KJ> Not sure why you think you have to write a new classmethod for KJ> each shape. Suppose you want to maintain cre

Re: [Tutor] Changing what you've already printed

2005-06-22 Thread Max Noel
On Jun 23, 2005, at 01:04, Alan G wrote: Curses comes as standard on linux... They also do on Windows. Just listen to any user when the bloody thing crashes. (sorry, couldn't resist :p ) More seriously, I seem to recall that on the contrary, the Windows Python distribution do

Re: [Tutor] Changing what you've already printed

2005-06-22 Thread Danny Yoo
On Wed, 22 Jun 2005, Ed Singleton wrote: > Yeah I think curses looks like it will do what I want. It doesn't > look particularly easy to use (the [y,x] format is going to trip me up > a lot) but I think I could write myself a simple interface to it that > would make it simpler for me to use. H

[Tutor] samples

2005-06-22 Thread D. Hartley
Hello, everyone! I hope this isnt the wrong place to post this, but the internet has not been very helpful to me on this point. I am looking for several (open-source, obviously) clones of Bejeweled (the pop cap game) or something like it. There is one listed at pygame (and that same one is refer

Re: [Tutor] loading an image into a Postgre database

2005-06-22 Thread Danny Yoo
On Wed, 22 Jun 2005, Mike Hansen wrote: > Thanks Danny. That did the trick. I think I had thought about putting > the variables in the execute statement, but I didn't run across any > examples. I'll need to read the DB API 2.0 docs some more. Hi Mike, No problem; it's actually a really common

Re: [Tutor] Class vs. Static Methods

2005-06-22 Thread Chuck Allison
This is a neat trick. But can't this also be done with a static method that accesses a static data attribute the same way? Alan G wrote: >>class Shape(object): >> _count = 0 >> >> @classmethod >> def count(cls): >>try: >> cls._count += 1 >>except AttributeError: >> cls

Re: [Tutor] List of regular expressions

2005-06-22 Thread Danny Yoo
On Wed, 22 Jun 2005, Shidan wrote: > Hi I have a list of regular expression patterns like such: > > thelist = ['^594694.*','^689.*','^241.*', >'^241(0[3-9]|1[0145]|2[0-9]|3[0-9]|41|5[1-37]|6[138]|75|8[014579]).*'] > > > Now I want to iterate thru each of these like: > > for pattern in thelis

Re: [Tutor] Changing what you've already printed

2005-06-22 Thread Alan G
> BTW, if you happen to need this while drawing only a single line, the > "\r" char gets you at the beginning of the current line ! And '\h' should delete back one char. Between the two techniques you can control a single line, but not, sadly, a noughts and crosses board! Alan G. ___

[Tutor] age of python programmers

2005-06-22 Thread Danny Yoo
On Wed, 22 Jun 2005, Danny Yoo wrote: > > > On Wed, 22 Jun 2005 [EMAIL PROTECTED] wrote: > > > What's the average age of a python user? This is my only question about > > programmers themselves. > > The message threading doesn't work perfectly, but just search for the > subject "O.T." from the

Re: [Tutor] question about programmers

2005-06-22 Thread Alan G
> What's the average age of a python user? This is my only question about > programmers themselves. > There was a thread on this on comp.lang.python recently. Try searching google groups and you should find literally hundreds of replies! >From memory average was around 30 but with a distributi

Re: [Tutor] Changing what you've already printed

2005-06-22 Thread Alan G
> Is it possible (and easy) to change something you've already printed > rather than print again? Its possible. How easy depends on where you are printing. Using curses in a character based terminal its easy, just define the window within the screen that you want to change. Similarly any GUI too

Re: [Tutor] question about programmers

2005-06-22 Thread Danny Yoo
On Wed, 22 Jun 2005 [EMAIL PROTECTED] wrote: > What's the average age of a python user? This is my only question about > programmers themselves. Hi Catdude, We actually had a small thread about this a few months back. The subject line "O.T." from that thread didn't make it particularly eas

Re: [Tutor] Class vs. Static Methods

2005-06-22 Thread Alan G
> class Shape(object): > _count = 0 > > @classmethod > def count(cls): > try: > cls._count += 1 > except AttributeError: > cls._count = 1 Ah, clever. This is where I thought I'd need an if/elif chain, adding a new clause for each subclass. i never thought of usin

Re: [Tutor] question about programmers

2005-06-22 Thread John Purser
If that's your only question about programmers then you aint been around them much. I'm 45. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, June 22, 2005 14:38 To: tutor@python.org Subject: [Tutor] question abo

[Tutor] question about programmers

2005-06-22 Thread Catdude2000
What's the average age of a python user?  This is my only question about programmers themselves. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] MySQL Connection Function

2005-06-22 Thread Don Parris
On Tue, 21 Jun 2005 19:13:43 -0400 Python <[EMAIL PROTECTED]> wrote: Alright, I've had time to play with this and wanted to be sure I understand this well. It works, so I understand enough to make it work. However, I see a difference between your code and mine that makes me think I've missed so

[Tutor] CGIXMLRPCRequestHandler doesn't actually work, does it?

2005-06-22 Thread Ron Phillips
I believe I've tried every setting known to man, in every script in every little scrap of documentation available. XMLRPC requests using SimpleXMLRPCRequestHandler -- no problem. But try to run them as a CGI script, and I get system lock ups and that's all. No error codes; no response whatsoever.

Re: [Tutor] Changing what you've already printed

2005-06-22 Thread Ed Singleton
Yeah I think curses looks like it will do what I want. It doesn't look particularly easy to use (the [y,x] format is going to trip me up a lot) but I think I could write myself a simple interface to it that would make it simpler for me to use. Pierre's '/r' char thing isn't enough for what I want

Re: [Tutor] Changing what you've already printed

2005-06-22 Thread Wolfram Kraus
Curses might help you: http://docs.python.org/lib/module-curses.html Take a look at the Demo-directory which is included in the Python source-package. There is a curses subdir in it which might get you started. HTH, Wolfram Ed Singleton wrote: > Is it possible (and easy) to change something you

Re: [Tutor] Changing what you've already printed

2005-06-22 Thread Pierre Barbier de Reuille
Well, it is certainly possible. First, the hard way: you use the ANSI termainal control commands (you can find the reference on the web, or if you need it I can send you an HTML file containing them). Second, the better way: you can use the ncurse library (via the curses Python module). There you'l

Re: [Tutor] loading an image into a Postgre database

2005-06-22 Thread Mike Hansen
Thanks Danny. That did the trick. I think I had thought about putting the variables in the execute statement, but I didn't run across any examples. I'll need to read the DB API 2.0 docs some more. Mike Danny Yoo wrote: >>Thankfully, you don't have to change much to fix the formatting bug. The

[Tutor] Changing what you've already printed

2005-06-22 Thread Ed Singleton
Is it possible (and easy) to change something you've already printed rather than print again? For example, if I'm making a little noughts and crosses game and I print the board: | | | | ___|___|___ | | | | ___|___|___ | | | | | | Then the c

Re: [Tutor] Class vs. Static Methods

2005-06-22 Thread Kent Johnson
Alan G wrote: > So If I have a heirarchy of shapes and want a class method that > only operates on the shape class itself, not on all the > subclasses then I have to use staticmethod whereas if I want > the class method to act on shape and each of its sub classes > I must use a classmethod. The can

Re: [Tutor] how do i pause a script ?

2005-06-22 Thread Simon Gerber
>Hey all, >how do i pause a script. like >print 'something' >pause a half second >print 'something else' > > Hi, I think you're looking for 'sleep' in the time module. >>> import time >>> print "something" >>> time.sleep(1) >>> print "something else" That should do what you're describing

Re: [Tutor] List of regular expressions

2005-06-22 Thread Alan G
> for pattern in thelist: >regex=re.compile(pattern) >if regex.match('24110'): >the_pattern = pattern >. >. >sys.exit(0) > > but in this case it will pick thelist[2] and not the list[3] as I wanted to, > how can I have it pick the pattern that describes it be

Re: [Tutor] Class vs. Static Methods

2005-06-22 Thread Alan G
- Original Message - From: "Kent Johnson" <[EMAIL PROTECTED]> > No, a classmethod is passed the class that it is called on. > If you have an inheritance tree you don't know this with a staticmethod. Aha! Like the OP I was aware of the class/no class distinction but couldn't see how this

Re: [Tutor] List of regular expressions

2005-06-22 Thread Ewald Ertl
Hi Shidan! on Wed, 22 Jun 2005 00:28:44 -0400 Shidan <[EMAIL PROTECTED]> wrote : - Shidan > Hi I have a list of regular expression patterns like such: Shidan > Shidan > thelist = ['^594694.*','^689.*','