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
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
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
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
--
[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 +=
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
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 =
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
tried that, didn't work for me
--
http://mail.python.org/mailman/listinfo/python-list
nope didn't work
--
http://mail.python.org/mailman/listinfo/python-list
[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
11 matches
Mail list logo