Re: newb: Simple regex problem headache

2007-09-21 Thread Erik Jones
On Sep 21, 2007, at 4:04 PM, crybaby wrote: > import re > > s1 =' 25000 ' > s2 = ' 5.5910 ' > > mypat = re.compile('[0-9]*(\.[0-9]*|$)') > rate= mypat.search(s1) > print rate.group() > > rate=mypat.search(s2) > print rate.group() > rate = mypat.search(s1) > price = float(rate.group()) > print pri

Re: newb: Simple regex problem headache

2007-09-21 Thread Ian Clark
crybaby wrote: > import re > > s1 =' 25000 ' > s2 = ' 5.5910 ' > > mypat = re.compile('[0-9]*(\.[0-9]*|$)') > rate= mypat.search(s1) > print rate.group() > > rate=mypat.search(s2) > print rate.group() > rate = mypat.search(s1) > price = float(rate.group()) > print price > > I get an error when

Re: newb: Simple regex problem headache

2007-09-21 Thread chris . monsanto
On Sep 21, 5:04 pm, crybaby <[EMAIL PROTECTED]> wrote: > import re > > s1 =' 25000 ' > s2 = ' 5.5910 ' > > mypat = re.compile('[0-9]*(\.[0-9]*|$)') > rate= mypat.search(s1) > print rate.group() > > rate=mypat.search(s2) > print rate.group() > rate = mypat.search(s1) > price = float(rate.group()) >

newb: Simple regex problem headache

2007-09-21 Thread crybaby
import re s1 =' 25000 ' s2 = ' 5.5910 ' mypat = re.compile('[0-9]*(\.[0-9]*|$)') rate= mypat.search(s1) print rate.group() rate=mypat.search(s2) print rate.group() rate = mypat.search(s1) price = float(rate.group()) print price I get an error when it hits the whole number, that is in this forma