Re: [Tutor] Regex parsing and writing to file

2007-10-16 Thread Kent Johnson
Peter Mexbacher wrote: > I have the following task: > > 1) read in a file line by line > 2) parse each line with a regular expression, and substitute certain > patterns > 3) end result: the old file with the substituted stuff (and of course > everything which did not need substitution) > > Do

Re: [Tutor] Regex parsing and writing to file

2007-10-16 Thread Tim Golden
Peter Mexbacher wrote: > Hello, > > first post here :-) > > I have the following task: > > 1) read in a file line by line > 2) parse each line with a regular expression, and substitute certain > patterns > 3) end result: the old file with the substituted stuff (and of course > everything which

[Tutor] Regex parsing and writing to file

2007-10-16 Thread Peter Mexbacher
Hello, first post here :-) I have the following task: 1) read in a file line by line 2) parse each line with a regular expression, and substitute certain patterns 3) end result: the old file with the substituted stuff (and of course everything which did not need substitution) My question: Do

Re: [Tutor] Timers in Python

2007-10-16 Thread Trilok Khairnar
Doug Hellmann's PyMotW (Python Module of the Week) series recently covered sched http://feeds.feedburner.com/~r/PyMOTW/~3/161303668/pymotw-sched.html He always provides an overview supported by examples. You think of a functionality in some context, and it tends to appear in the series. :-) Regar

Re: [Tutor] symbol encoding and processing problem

2007-10-16 Thread Tim Michelsen
> How do you get this output? The print is after the statement causing the > traceback. Are you showing the same code as you ran? Yes. I created this file in PythonWin and run it with IPython. > It displays correctly for me (on MacOS X). Are you sure your source is > actually encoded in utf-8? N

Re: [Tutor] symbol encoding and processing problem

2007-10-16 Thread Kent Johnson
Tim Michelsen wrote: > Dear list, > I have encountered a problem with encoding of user input and variables. > Heres my test script: Posting without the line numbers would make it easier to try your code. > > 1 #!/usr/bin/env python > 2 # -*- coding: utf-8 -*- > 3 from easygui import easygui >

Re: [Tutor] symbol encoding and processing problem

2007-10-16 Thread Evert Rol
Hi Tim, > Heres my test script: > > 1 #!/usr/bin/env python > 2 # -*- coding: utf-8 -*- > 3 from easygui import easygui > 4 import sys > 5 #raw = sys.argv[1] > 6 raw = easygui.enterbox(message="Enter something.", title="", > argDefaultText="20° 12' 33''") > 7 #unicode = unicode(raw) > 8

Re: [Tutor] All Apress Titles 50% off sale

2007-10-16 Thread Dick Moores
At 04:55 AM 10/16/2007, Kent Johnson wrote: >Dick Moores wrote: > > > >Broken at the moment...but to clarify, IIUC it is Bookpool that is >having the sale, not Apress. >http://www.bookpool.com/ Certainly is. Thanks, Kent. Dick ___

Re: [Tutor] Decimal Conversion

2007-10-16 Thread Linpeiheng
There is one small mistake in Michael's answer. Variable 'r' should not be put behind but ahead. So operator '+=' could not be used here. You can use the following statement instead. b = r + ',' + b Operator '+' concatenate string together to make a new string. In this

Re: [Tutor] All Apress Titles 50% off sale

2007-10-16 Thread Kent Johnson
Dick Moores wrote: > Broken at the moment...but to clarify, IIUC it is Bookpool that is having the sale, not Apress. http://www.bookpool.com/ Kent > That includes some titles that aren't out yet, such as: > > The Definitive Guide to Django: Web Development Done Right >

[Tutor] symbol encoding and processing problem

2007-10-16 Thread Tim Michelsen
Dear list, I have encountered a problem with encoding of user input and variables. I want to read in user defined coordinates as a string like: 121° 55' 5.55'' Furthermore I would like to extract the degrees (integer number before the " ° " sign), the minutes (integer number before the " ' " sign)

Re: [Tutor] All Apress Titles 50% off sale

2007-10-16 Thread bhaaluu
On 10/15/07, Dick Moores <[EMAIL PROTECTED]> wrote: > > That includes some titles that aren't out yet, such as: > > The Definitive Guide to Django: Web Development Done Right > > > Beginning Game Development with Python and Pygame: Fr

Re: [Tutor] reading POST method in cgi script

2007-10-16 Thread Eric Abrahamsen
Thanks for the detailed help. I'm dumping sys.stdin into a variable at the very start now, and operating on that variable for everything else, and all is well. Thanks again, E On Oct 16, 2007, at 12:22 PM, Luke Paireepinart wrote: > Eric Abrahamsen wrote: >> I'm trying to learn the fundamen