Re: [Tutor] Should I use python for parsing text

2007-03-20 Thread János Juhász
Hy Jay, I just allways wonder how fine this book about text processing with python. Text Processing in Python at http://gnosis.cx/TPiP/ It shows that Python can be as effective as Perl. The question is the how. Take a look on it. Yours sincerely, __ János Juhász _

Re: [Tutor] Should I use python for parsing text

2007-03-20 Thread Luke Paireepinart
> # The next 5 lines are so I have an idea of how many lines i started > with in the file. > > in_filename = raw_input('What is the COMPLETE name of the file you > want to open:') > in_file = open(in_filename, 'r') > text = in_file.read() read() returns a one-dimensional list with all the da

Re: [Tutor] How to set value back to .conf file

2007-03-20 Thread John Fouhy
On 21/03/07, hok kakada <[EMAIL PROTECTED]> wrote: > I just start to use ConfigParser to store the configuration for my > application. [...] > Or i need to write it to the file using conf.write(fp)? > If so, how can I get this file pointer? Yes. You need to create a file-like object open for writ

[Tutor] How to set value back to .conf file

2007-03-20 Thread hok kakada
Hi all, I just start to use ConfigParser to store the configuration for my application. I surfed the mails related to ConfigParser, however I couldn't found the way of how to set value back to the .conf file. Let say, I have a test.conf file with: [General] userName="da" later on, I wanna add

[Tutor] Should I use python for parsing text

2007-03-20 Thread Jay Mutter III
"Jay Mutter III" wrote > See example next: > A.-C. Manufacturing Company. (See Sebastian, A. A., > and Capes, assignors.) >... >Aaron, Solomon E., Boston, Mass. Pliers. No. 1,329,155 ; >Jan. 27 ; v. 270 ; p. 554. > > For instance, I would like to go to end of line and if last > character is a

Re: [Tutor] The '45' bug in round()

2007-03-20 Thread Dick Moores
At 02:43 PM 3/20/2007, Terry Carroll wrote: >On Tue, 20 Mar 2007, Dick Moores wrote: > > > So you're claiming there's a bug in round()? > >No. I'm very reluctant to slap the "bug" label on behavior that strikes >me as anomalous. I've found a bug or two, but in most cases, it's far >more likely to

Re: [Tutor] Making table

2007-03-20 Thread János Juhász
Dear Barry, >>Using a formatting string of "%10.4f", these would be rendered as: >> >> ' 253.' >> ' 77.6000 >> '9.0300' >> '0.0210' >> >>This formatting gives the impression that all values but the last are >>more precise than

Re: [Tutor] The '45' bug in round()

2007-03-20 Thread Terry Carroll
On Tue, 20 Mar 2007, Dick Moores wrote: > So you're claiming there's a bug in round()? No. I'm very reluctant to slap the "bug" label on behavior that strikes me as anomalous. I've found a bug or two, but in most cases, it's far more likely to be working as designed, and the bug is in my per

Re: [Tutor] The '45' bug in round()

2007-03-20 Thread Dick Moores
At 02:24 PM 3/20/2007, Terry Carroll wrote: >On Tue, 20 Mar 2007, Dick Moores wrote: > > > >>> print round(0.19965, 4) > > 0.1997 > > > > (which rounds up to an odd number, 7) > >Now that's weird. It should (I say) round to .1996; not because 6 is even >and 7 is not[1], but because 0.19965 is act

Re: [Tutor] The '45' bug in round()

2007-03-20 Thread Terry Carroll
On Tue, 20 Mar 2007, Dick Moores wrote: > >>> print round(0.19965, 4) > 0.1997 > > (which rounds up to an odd number, 7) Now that's weird. It should (I say) round to .1996; not because 6 is even and 7 is not[1], but because 0.19965 is actually closer to 0.1996 than to 0.1997: >>> 0.19965 0.19

Re: [Tutor] threading and gui programming

2007-03-20 Thread Ben
That makes sense. I am a newbie to python programming. What really confuses me is that there are so many gui programming options for python (i.e. pywin32, wxPython, etc). Is this means that all of these available gui options be able to integrate with threading? Thanks. On 3/20/07, Kent Johnson <[

Re: [Tutor] threading and gui programming

2007-03-20 Thread Kent Johnson
Ben wrote: > Hi all, > > I am curious about one thing. I have been doing research on gui > programming. One thing that I don't understand is why there are some > examples uses threading in the gui examples. Is there any benefits or > advantages for using the threading in the gui programming? Th

[Tutor] threading and gui programming

2007-03-20 Thread Ben
Hi all, I am curious about one thing. I have been doing research on gui programming. One thing that I don't understand is why there are some examples uses threading in the gui examples. Is there any benefits or advantages for using the threading in the gui programming? Thanks. ___

Re: [Tutor] The '45' bug in round()

2007-03-20 Thread Michael Hannon
On Tue, Mar 20, 2007 at 09:03:43AM -0700, Dick Moores wrote: . . . > >Well, perhaps this is something for me to think about, but if you had asked > >me to round 0.19945 to four decimal places, I would have told you the > >answer > >is 0.1994, i.e., the same answer that Python gives. > > Is this b

Re: [Tutor] The '45' bug in round()

2007-03-20 Thread Dick Moores
At 08:31 AM 3/20/2007, you wrote: >On Tue, Mar 20, 2007 at 04:09:49AM -0700, Dick Moores wrote: > > At 11:00 AM 3/19/2007, Michael Hannon wrote: > > >On Mon, Mar 19, 2007 at 03:04:03AM -0700, Dick Moores wrote: > > >> Yesterday I was shocked, SHOCKED, to discover that round() is > > >> occasionally

Re: [Tutor] breaking the 'while' loop

2007-03-20 Thread Luke Paireepinart
> > > I want to limit the number of tries to 5. To do that, I have tried the > /_if structure_/ along with the /_break statement_/ immediately below the > > ‘tries += 1’ line: > Or you could just add this condition to the while loop. while (guess != the_number and tries < 6): > > if tries > 5: > >

Re: [Tutor] The '45' bug in round()

2007-03-20 Thread Michael Hannon
On Tue, Mar 20, 2007 at 04:09:49AM -0700, Dick Moores wrote: > At 11:00 AM 3/19/2007, Michael Hannon wrote: > >On Mon, Mar 19, 2007 at 03:04:03AM -0700, Dick Moores wrote: > >> Yesterday I was shocked, SHOCKED, to discover that round() is > >> occasionally rounding incorrectly. For example, > >> >

Re: [Tutor] breaking the 'while' loop

2007-03-20 Thread Andre Engels
2007/3/20, Alexander Kapshuk <[EMAIL PROTECTED]>: Dear All, I have been learning computer programming with Python only for a short while. I have a question to do with breaking the *while loop*. I have attached the source code of a program called 'Guess my number' with the *while loop* run

Re: [Tutor] breaking the 'while' loop

2007-03-20 Thread Alexander Kapshuk
Dear All, I have been learning computer programming with Python only for a short while. I have a question to do with breaking the while loop. I have attached the source code of a program called 'Guess my number' with the while loop running until the right number is guessed. I want to li

Re: [Tutor] The '45' bug in round()

2007-03-20 Thread Dick Moores
At 11:00 AM 3/19/2007, Michael Hannon wrote: >On Mon, Mar 19, 2007 at 03:04:03AM -0700, Dick Moores wrote: > > Yesterday I was shocked, SHOCKED, to discover that round() is > > occasionally rounding incorrectly. For example, > > > > >>> print round(0.19945,4) > > 0.1994 >. >. >. > > Comments, Tuto

Re: [Tutor] Making table

2007-03-20 Thread Kent Johnson
Carroll, Barry wrote: > This formatting gives the impression that all values but the last are > more precise than they truly are. A scientist or statistician would > prefer to see something like this: > > '254.' > ' 77.6 ' > ' 9.03 ' > ' 0.0210' > > Does numpy or