Re: New to using re. Search for a number before a string.

2013-11-02 Thread Justin Barber
I'm guessing that the name "FUDD, ELMER" varies. In that case, you might try something like this: >>> id_num_regex = re.compile(r'\d+(?=\w+\b,.+?)') >>> id_num_regex.findall(t) ['624309'] This would account for first names such as 'Mary Ann' and also automatically matches characters only to the

Re: retry many times decorator

2012-06-29 Thread Justin Barber
On Friday, June 29, 2012 4:53:43 AM UTC-4, andrea crotti wrote: > On the other hand now that I think again even supposing there is a > permanent error like MySql completely down, retrying continuosly > won't do any harm anyway because the machine will not be able to do > anything else anyway, when

Re: [newbie] problem with data (different behaviour between batch and interactive use)

2012-06-27 Thread Justin Barber
When you are reading it in measurement is a string. The indicies of the string are going to be returned in your print statements. Similar to having done this in the interpreter: In [17]: measurement = '+3.874693E01,+9.999889E03,+9.91E+37,+1.876595E+04,+3.994000E+04' In [18]: measurement[1]