Newbie needs regex help
Dan M
dan at catfolks.net
Mon Dec 6 10:44:39 EST 2010
On Mon, 06 Dec 2010 10:29:41 -0500, Mel wrote:
> What you're missing is that string `a` doesn't actually contain four-
> character sequences like '\', 'x', 'a', 'a' . It contains single
> characters that you encode in string literals as '\xaa' and so on. You
> might do better with
>
> p1 = r'([\x80-\xff])'
> r1 = re.compile (p1)
> m = r1.search (a)
>
> I get at least an <_sre.SRE_Match object at 0xb749a6e0> when I try this.
>
> Mel.
That's what I had initially assumed was the case, but looking at the data
files with a hex editor showed me that I do indeed have four-character
sequences. That's what makes this such as interesting task!
More information about the Python-list
mailing list