Re: how to remove 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*\W*', re.I) > > Agreed (on both counts), but r'\s*\s*'

Re: how to remove 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*\W*', re.I) Agreed (on both counts), but r'\s*\s*' might be better (consider what happ

Re: how to remove using replace function?

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

Re: how to remove using replace function?

2006-02-09 Thread Albert Leibbrandt
Rinzwind wrote: >Works for me. > > > txt = "an unfortunate in the middle" print txt.replace("", "") >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 cheers albert

Re: how to remove using replace function?

2006-02-09 Thread Duncan Booth
Rinzwind wrote: > Works for me. > txt = "an unfortunate in the middle" print txt.replace("", "") > 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 wher

Re: how to remove using replace function?

2006-02-09 Thread Rinzwind
Works for me. >>> txt = "an unfortunate in the middle" >>> print txt.replace("", "") 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 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

Re: how to remove using replace function?

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

Re: how to remove 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 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 in the middle" txt = txt.replace("", "") -- http://mail.python.org/mailman/listinfo/python-list

how to remove using replace function?

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