Re: [Tutor] uncomprehension on RE

2007-09-20 Thread cedric briner
Stephen Nelson-Smith wrote: > On 9/20/07, cedric briner <[EMAIL PROTECTED]> wrote: > >> To let you know, I'm writing a script to generate bind9 configuration >> from a nis hosts table. So I was trying in a one re to catch from this: >> >> [ ...] [# comment] >> e.g: >> 10.12.23.45 hostname1 alia

Re: [Tutor] uncomprehension on RE

2007-09-20 Thread cedric briner
Kent Johnson wrote: > cedric briner wrote: >> To let you know, I'm writing a script to generate bind9 configuration >> from a nis hosts table. So I was trying in a one re to catch from this: >> >> [ ...] [# comment] >> e.g: >> 10.12.23.45 hostname1 alias1 alias2 alias3 # there is a nice comment

Re: [Tutor] (no subject)

2007-09-20 Thread Alan Gauld
"david lazaro" <[EMAIL PROTECTED]> wrote > should say Game Over, but its cutting Over in half. As you know backslashes signal a line continuation. To put a literal backslash in a string you need to double it:@ print 'here is a \\' Or put an r in front of the quotes: print r'here is a \ too'

Re: [Tutor] (no subject)

2007-09-20 Thread Ian Witham
On 9/21/07, david lazaro <[EMAIL PROTECTED]> wrote: > > the book is called "Python Programming, Second Edition for the absolute > beginner". im using the triple quotes in the beginning and end. im sending > an attachment of what its coming out as. the actual program should say Game > Over, but its

[Tutor] (no subject)

2007-09-20 Thread david lazaro
the book is called "Python Programming, Second Edition for the absolute beginner". im using the triple quotes in the beginning and end. im sending an attachment of what its coming out as. the actual program should say Game Over, but its cutting Over in half. ___

Re: [Tutor] (no subject)

2007-09-20 Thread Alan Gauld
"david lazaro" <[EMAIL PROTECTED]> wrote > hi, im relatively new to this, Welcome to the tutor list. > im on chapter 2 of the python book Which one? There are dozens of python books! > and its asking me to print version 2.0 of "Game over" > by using keyboard art, Hint, Use a triple quoted

Re: [Tutor] (no subject)

2007-09-20 Thread Ian Witham
On 9/21/07, david lazaro <[EMAIL PROTECTED]> wrote: > > hi, im relatively new to this, im on chapter 2 of the python book and its > asking me to print version 2.0 of "Game over" by using keyboard art, but > when i draw out "over" is comes up half cut off, any reasons why that would > happen? > Ple

Re: [Tutor] Game over

2007-09-20 Thread Kent Johnson
david lazaro wrote: > hi, im relatively new to this, im on chapter 2 of the python book and > its asking me to print version 2.0 of "Game over" by using keyboard art, > but when i draw out "over" is comes up half cut off, any reasons why > that would happen? Welcome! Some tips for getting help

[Tutor] (no subject)

2007-09-20 Thread david lazaro
hi, im relatively new to this, im on chapter 2 of the python book and its asking me to print version 2.0 of "Game over" by using keyboard art, but when i draw out "over" is comes up half cut off, any reasons why that would happen?

Re: [Tutor] how to specify working directory from within python app?

2007-09-20 Thread Rob Andrews
Thanks (to Alan, as well). I had a wild suspicion that there would be a fairly standard solution to this one. I've just never had to really look into it before. On 9/20/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > Rob Andrews wrote: > > I've got a weekly project here in which I have to take a som

Re: [Tutor] how to specify working directory from within python app?

2007-09-20 Thread Alan Gauld
"Rob Andrews" <[EMAIL PROTECTED]> wrote > I've got a weekly project here in which I have to take a somewhat > arbitrary number of input files, create working directories in which > to process each of them, and call other programs from within the > scope > of those directories. > > The source file

Re: [Tutor] how to specify working directory from within python app?

2007-09-20 Thread Kent Johnson
Rob Andrews wrote: > I've got a weekly project here in which I have to take a somewhat > arbitrary number of input files, create working directories in which > to process each of them, and call other programs from within the scope > of those directories. Use subprocess.call() to run the external p

[Tutor] how to specify working directory from within python app?

2007-09-20 Thread Rob Andrews
I've got a weekly project here in which I have to take a somewhat arbitrary number of input files, create working directories in which to process each of them, and call other programs from within the scope of those directories. The source files are in a directory named 'orig' under the project roo

[Tutor] IRC bot

2007-09-20 Thread Ulrich Holtzhausen
Thank you Kent. That worked for the output and I'm able to understand the IRC commands and syntaxes much better now. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] OO triangulation with attacment

2007-09-20 Thread János Juhász
Dear Tutors, I made an OO style triangulation based on an old C progam I made about 10 years ago. This makes Delaunay triangualtion over a point cloud in 2D. http://en.wikipedia.org/wiki/Delaunay_triangulation The sample is working finally. First time I made the triangulation with recursion, bu

Re: [Tutor] OO triangulation

2007-09-20 Thread Luke Paireepinart
bhaaluu wrote: > Greetings, > > I'm running Python 2.4 on a GNU/Linux system. > Actually, I was able to get this code to work after only a few > edits that had to do with line wrap, nothing more. Other people are less willing to do this than you are :) It's really the OP's prerogative to make messa

Re: [Tutor] Finding prime numbers

2007-09-20 Thread Luke Paireepinart
Michael Langford wrote: > Attachments are a bad thing to send to open mailing lists in general. Perhaps in general they are, but specifically, I'd prefer code that's decently long to be attached or pastebinned. e-mail clients and servers are often unfriendly on code. That's the point of attachment

Re: [Tutor] Income calculator

2007-09-20 Thread Alan Gauld
"bhaaluu" <[EMAIL PROTECTED]> wrote > Now he needs to add a way to save the details to a file, and open > the file to edit the details. If I'm not mistaken, since the details > are > in dictionary form, a 'pickle' is called for? =) I think you are thinking of a shelve which looks a lot like a

Re: [Tutor] IRC bot

2007-09-20 Thread Luke Paireepinart
Ulrich Holtzhausen wrote: Hey, Well I have the following: data_received = s.recv(1024) print data_received That only prints this when the bot connects: ''':irc.opera.com NOTICE AUTH :*** Looking up your hostname...''' Nothing else, so I am not sure whether it would actually save anything ot

Re: [Tutor] uncomprehension on RE

2007-09-20 Thread Kent Johnson
cedric briner wrote: > To let you know, I'm writing a script to generate bind9 configuration > from a nis hosts table. So I was trying in a one re to catch from this: > > [ ...] [# comment] > e.g: > 10.12.23.45 hostname1 alias1 alias2 alias3 # there is a nice comment > 37.64.86.23 hostname2 >

Re: [Tutor] OO triangulation

2007-09-20 Thread bhaaluu
Greetings, I'm running Python 2.4 on a GNU/Linux system. Actually, I was able to get this code to work after only a few edits that had to do with line wrap, nothing more. The code works fine, and although I don't understand what it is displaying, the display is rather interesting. On my 1GHz CPU,

Re: [Tutor] IRC bot

2007-09-20 Thread Kent Johnson
Ulrich Holtzhausen wrote: > I recently used the existing codebase of a very very simple IRC bot of > which is in one of O'Reilly's books. I modified it a bit and added the > NICK properties etc. and I was able to get it to join the server and my > IRC channel. However I'd like to know how can I

Re: [Tutor] Threading in Python

2007-09-20 Thread Kent Johnson
Eric Brunson wrote: > I mention that because when you combine a fork with an exec, you get a > spawn. Your parent process duplicates itself, but the child process > chooses to exec another process. So the child copy of the initial > process is replaced by new running binary and you have a spaw

[Tutor] Income calculator

2007-09-20 Thread Ulrich Holtzhausen
Boykie Mackay wrote: > I have tried the code and it does give a syntax error.Another lesson for > me I guess.I should test code before posting,unless I'm sure of my post. > > The problem was with the brackets in lines 17/18.I got the code running > but I don't think the 'quit' function works as it

[Tutor] IRC bot

2007-09-20 Thread Ulrich Holtzhausen
Hey, Well I have the following: data_received = s.recv(1024) print data_received That only prints this when the bot connects: ''':irc.opera.com NOTICE AUTH :*** Looking up your hostname...''' Nothing else, so I am not sure whether it would actually save anything other than that if I chose to

Re: [Tutor] Income calculator

2007-09-20 Thread bhaaluu
On 9/20/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "Boykie Mackay" <[EMAIL PROTECTED]> wrote > > >I have tried the code and it does give a syntax error.Another lesson > >for > > me I guess.I should test code before posting,unless I'm sure of my > > post. > > It's a good idea, but don't worry abo

Re: [Tutor] uncomprehension on RE

2007-09-20 Thread Luke Paireepinart
Stephen Nelson-Smith wrote: > On 9/19/07, cedric briner <[EMAIL PROTECTED]> wrote: > >> Hello, >> >> I do not understand the behaviour of this: >> >> import re >> re.search('(a)*','aaa').groups() >> ('a',) >> >> I was thinking that the ``*'' will operate on the group delimited by the >> parenthe

Re: [Tutor] OO triangulation

2007-09-20 Thread Luke Paireepinart
János Juhász wrote: > Dear Tutors, > > I made an OO style triangulation based on an old C progam I made about 10 > years ago. > The sample is working finally. > First time I made the triangulation with recursion, but I reached the > recursion limit very shortly. > So I changed the recursion to a

Re: [Tutor] IRC bot

2007-09-20 Thread Luke Paireepinart
Ulrich Holtzhausen wrote: > शंतनु (Shantanoo) wrote: > >> Instead of writing your own code for the bot, I would suggest using >> supybot (http://supybot.com/). >> >> regards, >> shantanoo >> >> > Hey, thank you for the suggestion. I do know about supybot and phenny, > both are python bo

Re: [Tutor] IndexError: list index out of range

2007-09-20 Thread bhaaluu
On 9/20/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > "bhaaluu" <[EMAIL PROTECTED]> wrote > > > of it. But the search worked even when stackB > > and stackC were empty. Interesting. > > You never checked stackB or stackC when they were > empty because it always found something in a prior > stack firs

Re: [Tutor] Income calculator

2007-09-20 Thread Alan Gauld
"Boykie Mackay" <[EMAIL PROTECTED]> wrote >I have tried the code and it does give a syntax error.Another lesson >for > me I guess.I should test code before posting,unless I'm sure of my > post. It's a good idea, but don't worry about it. I've been caught out a few times myself. Alan G

Re: [Tutor] Income calculator

2007-09-20 Thread Boykie Mackay
I have tried the code and it does give a syntax error.Another lesson for me I guess.I should test code before posting,unless I'm sure of my post. The problem was with the brackets in lines 17/18.I got the code running but I don't think the 'quit' function works as it should. Being a novice I thin

Re: [Tutor] IRC bot

2007-09-20 Thread Ulrich Holtzhausen
शंतनु (Shantanoo) wrote: > Instead of writing your own code for the bot, I would suggest using > supybot (http://supybot.com/). > > regards, > shantanoo > Hey, thank you for the suggestion. I do know about supybot and phenny, both are python bots. I want to get experience in some IRC parameters

Re: [Tutor] IRC bot

2007-09-20 Thread शंतनु (Shantanoo)
On 9/20/07, Ulrich Holtzhausen <[EMAIL PROTECTED]> wrote: > I recently used the existing codebase of a very very simple IRC bot of > which is in one of O'Reilly's books. I modified it a bit and added the > NICK properties etc. and I was able to get it to join the server and my > IRC channel. Howeve

[Tutor] IRC bot

2007-09-20 Thread Ulrich Holtzhausen
I recently used the existing codebase of a very very simple IRC bot of which is in one of O'Reilly's books. I modified it a bit and added the NICK properties etc. and I was able to get it to join the server and my IRC channel. However I'd like to know how can I get it to print to screen what's

Re: [Tutor] uncomprehension on RE

2007-09-20 Thread Stephen Nelson-Smith
On 9/20/07, cedric briner <[EMAIL PROTECTED]> wrote: > To let you know, I'm writing a script to generate bind9 configuration > from a nis hosts table. So I was trying in a one re to catch from this: > > [ ...] [# comment] > e.g: > 10.12.23.45 hostname1 alias1 alias2 alias3 # there is a nice com

Re: [Tutor] Income calculator

2007-09-20 Thread Ulrich Holtzhausen
Alan Gauld wrote: > "Boykie Mackay" <[EMAIL PROTECTED]> wrote > > >> doesn't seem to be properly formatted.There should be a comma after >> the >> closing quotation marks,a closing bracket after the first variable >> and a >> % sign before the next i.e: >> >> >>> print "Your expected earn

Re: [Tutor] Income calculator

2007-09-20 Thread Alan Gauld
"Boykie Mackay" <[EMAIL PROTECTED]> wrote > doesn't seem to be properly formatted.There should be a comma after > the > closing quotation marks,a closing bracket after the first variable > and a > % sign before the next i.e: > >> print "Your expected earnings for %s is %d", >> %(financeLogs['m

Re: [Tutor] Threading in Python

2007-09-20 Thread Alan Gauld
"James" <[EMAIL PROTECTED]> wrote > I have a question regarding threading in Python. I'm trying to > write > a wrapper script in Python that will spin off multiple (lots!) of > instances of an I/O benchmark/testing utility. Are these instances of an external program or simply instances of some

Re: [Tutor] Income calculator

2007-09-20 Thread Boykie Mackay
I don't know if it's any help,but the line mentioned in the error message; File "./pyfinances.py", line 18 >print "Your expected earnings for %s is %d" % > (financeLogs['month'], > financeLogs['total']) >^ doesn't seem to be properly formatted.There sh

Re: [Tutor] Income calculator

2007-09-20 Thread Alan Gauld
"Ulrich Holtzhausen" <[EMAIL PROTECTED]> wrote First the good news, what you are doing should work. > File "./pyfinances.py", line 18 >print "Your expected earnings for %s is %d" % > (financeLogs['month'], > financeLogs['total']) >^ > SyntaxError: invalid syntax > > Non-working pro

Re: [Tutor] IndexError: list index out of range

2007-09-20 Thread Alan Gauld
"bhaaluu" <[EMAIL PROTECTED]> wrote > of it. But the search worked even when stackB > and stackC were empty. Interesting. You never checked stackB or stackC when they were empty because it always found something in a prior stack first. > I could see, all three conditionals in popNum(num) > w