Re: [Tutor] associating two objects without ORM and processing a text file

2013-02-14 Thread eryksun
On Thu, Feb 14, 2013 at 4:33 PM, Prasad, Ramit wrote: > My knee jerk response is a try/finally block, but I am sure there > are better ways. The atexit.register decorator hooks sys.exitfunc: http://docs.python.org/2/library/atexit Registered atexit functions are run early during interpreter fin

Re: [Tutor] associating two objects without ORM and processing a text file

2013-02-14 Thread neubyr
On Thu, Feb 14, 2013 at 4:05 PM, Dave Angel wrote: > On 02/14/2013 04:33 PM, Prasad, Ramit wrote: > >> Dave Angel wrote: >> >>> On 02/14/2013 12:35 PM, Prasad, Ramit wrote: >>> neubyr wrote: > I am not sure how to save an object in memory to a file before exiting > the program.

Re: [Tutor] associating two objects without ORM and processing a text file

2013-02-14 Thread neubyr
On Wed, Feb 13, 2013 at 1:55 PM, Alan Gauld wrote: > On 13/02/13 19:14, neubyr wrote: > > I am not sure how to save an object in memory to a file >> before exiting the program. Any examples or related documentation links >> would be really helpful. I am guessing it would be using some kind of >>

Re: [Tutor] use of variables in re.sub

2013-02-14 Thread Oscar Benjamin
On 14 February 2013 12:57, Eva Bofias wrote: > Helo, Hi, > I need to do a substitution in a regular expression that depends on a > variable. To simplify I want to be able to do this substitution: > > text2='XX. AA YY. DD' > re.sub(ur"\. (AA|BB|ÇÇ","(.) \g<1>",text2) There is a missing bracket i

Re: [Tutor] Newbie Here -- Averaging & Adding Madness Over a Given (x) Range?!?!

2013-02-14 Thread bob gailer
On 2/14/2013 3:55 PM, Michael McConachie wrote: [snip] I agree with dave angel - the specification is far from clear. please clarify. perhaps a simple example that goes from input to desired output. -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tuto

Re: [Tutor] Newbie Here -- Averaging & Adding Madness Over a Given (x) Range?!?!

2013-02-14 Thread Steven D'Aprano
On 15/02/13 07:55, Michael McConachie wrote: Essentially: 1. I have a list of numbers that already exist in a file. I generate this file by parsing info from logs. 2. Each line contains an integer on it (corresponding to the number of milliseconds that it takes to complete a certain repeat

Re: [Tutor] associating two objects without ORM and processing a text file

2013-02-14 Thread Dave Angel
On 02/14/2013 04:33 PM, Prasad, Ramit wrote: Dave Angel wrote: On 02/14/2013 12:35 PM, Prasad, Ramit wrote: neubyr wrote: I am not sure how to save an object in memory to a file before exiting the program. Any examples or related documentation links would be really helpful. I am guessing it w

[Tutor] Python needs your help -- trademark under attack

2013-02-14 Thread Steven D'Aprano
Hello all, The Python Software Foundation is the organisation which protects and manages the "boring" bits of keeping a big open source project alive: the legal and contractual parts, funding for projects, trademarks and copyrights. If you are based in Europe, or know somebody who uses Python

Re: [Tutor] Newbie Here -- Averaging & Adding Madness Over a Given (x) Range?!?!

2013-02-14 Thread Dave Angel
On 02/14/2013 03:55 PM, Michael McConachie wrote: Hello all, This is my first post here. I have tried to get answers from StackOverflow, but I realized quickly that I am too "green" for that environment. As such, I have purchased Beginning Python (2nd edition, Hetland) and also the $29.00 co

Re: [Tutor] associating two objects without ORM and processing a text file

2013-02-14 Thread Prasad, Ramit
Dave Angel wrote: > On 02/14/2013 12:35 PM, Prasad, Ramit wrote: > > neubyr wrote: > >> I am not sure how to save an object in memory to a file before exiting the > >> program. Any examples or > >> related documentation links would be really helpful. I am guessing it > >> would be using some kind

[Tutor] Newbie Here -- Averaging & Adding Madness Over a Given (x) Range?!?!

2013-02-14 Thread Michael McConachie
Hello all, This is my first post here. I have tried to get answers from StackOverflow, but I realized quickly that I am too "green" for that environment. As such, I have purchased Beginning Python (2nd edition, Hetland) and also the $29.00 course available from learnpythonthehardway(dot)com.

Re: [Tutor] associating two objects without ORM and processing a text file

2013-02-14 Thread Dave Angel
On 02/14/2013 12:35 PM, Prasad, Ramit wrote: neubyr wrote: I am not sure how to save an object in memory to a file before exiting the program. Any examples or related documentation links would be really helpful. I am guessing it would be using some kind of before teardown method, but not sure

Re: [Tutor] associating two objects without ORM and processing a text file

2013-02-14 Thread Prasad, Ramit
neubyr wrote: > I am not sure how to save an object in memory to a file before exiting the > program. Any examples or > related documentation links would be really helpful. I am guessing it would > be using some kind of > before teardown method, but not sure about it. Any help? Look at the pickl

[Tutor] use of variables in re.sub

2013-02-14 Thread Eva Bofias
Helo, I need to do a substitution in a regular expression that depends on a variable. To simplify I want to be able to do this substitution: text2='XX. AA YY. DD' re.sub(ur"\. (AA|BB|ÇÇ","(.) \g<1>",text2) this would give as a result: 'XX(.) AA YY. DD' Which is exactly what I want. But when I t