[BangPypers] Reg Expression problem and Unicode...

Sam's Lists samslists at gmail.com
Wed May 27 09:55:48 CEST 2009


Anand---

Thanks, that worked great.

-Sam

On Tue, May 26, 2009 at 7:34 PM, Anand Chitipothu <anandology at gmail.com>wrote:

> > text = "The Price £7"
> > pattern = u"£\d"
> >
> > m = re.search(pattern, text, re.UNICODE)
> > print m.group(0)
>
> Your text is in utf-8 encoding and pattern in unicode.
> Make text unicode solves the issue.
>
> text = u"The Price £7"
> pattern = u"£\d"
> m = re.search(pattern, text, re.UNICODE)
> print m.group(0).encode('utf-8')
>
> Anand
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20090527/d7558592/attachment.htm>


More information about the BangPypers mailing list