Re: How to use python regular expression to substitute string value

2006-02-26 Thread Pasi Savolainen
[EMAIL PROTECTED] writes: > When I try your idea, I have this error > > x, y, width, height = re.findall(pattern, str)[0] > IndexError: list index out of range > > How can I use findall to handle error case? i.e. what if there is no > match? how can I handle it gracefully? This is explained i

Re: How to use python regular expression to substitute string value

2006-02-26 Thread Pasi Savolainen
[EMAIL PROTECTED] writes: > Hi, > I am new to python. I would like to know how to use python regular > expression to substitute string value? > I have an input string like this: > x:11 y:0 w:760 h:19 area:14440 areaPerCent:0 > totalAreaPerCent:-3.08011e+16 type:3 path:///-/1/1 > > and I would like