thanks it works!! :) > Date: Sat, 22 Jan 2011 19:51:35 -0500 > Subject: Re: [Tutor] Help on RE > From: ja...@pearachute.com > To: tc...@hotmail.com > CC: tutor@python.org > > it's a bug in your regex - you want something like "-?\d+" > > - japhy > > On Sat, Jan 22, 2011 at 7:38 PM, tee chwee liong <tc...@hotmail.com> wrote: > > hi, > > > > i have a set of data and using re to extract it into array. however i only > > get positive value, how to extract the whole value including the -ve sign? > > For eg: > > > > Platform: PC > > Tempt : 25 > > TAP0 :0 > > TAP1 :1 > > +++++++++++++++++++++++++++++++++++++++++++++ > > Port Chnl Lane EyVt EyHt > > +++++++++++++++++++++++++++++++++++++++++++++ > > 0 1 1 75 55 > > 0 1 2 10 35 > > 0 1 3 25 35 > > 0 1 4 35 25 > > 0 1 5 10 -1 > > +++++++++++++++++++++++++++++++++++++++++++++ > > Time: 20s > > > > When i run my code, i get 1 instead of -1 in the last line. here is my code. > > pls advise. i'm using Python 2.5 and Win XP. tq > > ##code### > > import re > > file = open("C:/Python25/myscript/plot/sampledata.txt", "r") > > x1 = [] > > y1 = [] > > y2 = [] > > for line in file: > > numbers = re.findall("\d+", line) > > print numbers > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > To unsubscribe or change subscription options: > > http://mail.python.org/mailman/listinfo/tutor > > > >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor