Why isn't my re.sub replacing the contents of my MS Word file?

Chris Angelico rosuav at gmail.com
Tue May 13 09:55:57 EDT 2014


On Tue, May 13, 2014 at 11:49 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
>
>     This {EN DASH} is an n-dash.
>
> or:
>
>     x\x9c\x0b\xc9\xc8,V\xa8v\xf5Spq\x0c\xf6\xa8U\x00r\x12
>     \xf3\x14\xf2tS\x12\x8b3\xf4\x00\x82^\x08\xf8
>
>
> (that last one is the text passed through the zlib compressor)

I had to decompress that just to see what "text" you passed through
zlib, given that zlib is a *byte* compressor :) Turns out it's the
braced notation given above, encoded as ASCII/UTF-8.

ChrisA



More information about the Python-list mailing list