Re: how to remove BR using replace function?

2006-02-10 Thread Duncan Booth
Sion Arrowsmith wrote: Duncan Booth [EMAIL PROTECTED] wrote: Although I generally advise against overuse of regular expressions, this is one situation where regular expressions might be useful: [ ... ] nobr = re.compile('\W*br.*?\W*', re.I) Agreed (on both counts), but r'\s*br.*?\s*' might

Re: how to remove BR using replace function?

2006-02-09 Thread Rinzwind
Works for me. txt = an unfortunate br in the middle print txt.replace(br, ) an unfortunate in the middle Though I don't like the 2 spaces it gives ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove BR using replace function?

2006-02-09 Thread Duncan Booth
Rinzwind wrote: Works for me. txt = an unfortunate br in the middle print txt.replace(br, ) an unfortunate in the middle Though I don't like the 2 spaces it gives ;) Although I generally advise against overuse of regular expressions, this is one situation where regular

Re: how to remove BR using replace function?

2006-02-09 Thread Albert Leibbrandt
Rinzwind wrote: Works for me. txt = an unfortunate br in the middle print txt.replace(br, ) an unfortunate in the middle Though I don't like the 2 spaces it gives ;) so use regex and replace both the double spaces and the br cheers albert --

Re: how to remove BR using replace function?

2006-02-09 Thread bruno at modulix
[EMAIL PROTECTED] wrote: i have some html that looks like this address style=color:#34 main,br Boston, MA/address and i am trying to use the replace function to get rid of the Br that i scrape out using this code: for oText in incident.fetchText( oRE): strTitle +=

Re: how to remove BR using replace function?

2006-02-09 Thread Sion Arrowsmith
Duncan Booth [EMAIL PROTECTED] wrote: Although I generally advise against overuse of regular expressions, this is one situation where regular expressions might be useful: [ ... ] nobr = re.compile('\W*br.*?\W*', re.I) Agreed (on both counts), but r'\s*br.*?\s*' might be better (consider what

how to remove BR using replace function?

2006-02-08 Thread localpricemaps
i have some html that looks like this address style=color:#34 main,br Boston, MA/address and i am trying to use the replace function to get rid of the Br that i scrape out using this code: for oText in incident.fetchText( oRE): strTitle += oText.strip() strTitle =

Re: how to remove BR using replace function?

2006-02-08 Thread Dylan Moreland
I think you want to use the replace method of the string instance. Something like this will work: # See http://docs.python.org/lib/string-methods.html#l2h-196 txt = an unfortunate br in the middle txt = txt.replace(br, ) -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove BR using replace function?

2006-02-08 Thread localpricemaps
tried that, didn't work for me -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove BR using replace function?

2006-02-08 Thread localpricemaps
nope didn't work -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove BR using replace function?

2006-02-08 Thread Dylan Moreland
[EMAIL PROTECTED] wrote: nope didn't work Could you be more specific about the error? Both my example and yours work perfectly on my box. -- http://mail.python.org/mailman/listinfo/python-list