Searching binary data

Darrell darrell at dorb.com
Wed Feb 2 23:19:55 EST 2000


From: "Tim Peters"
> Actually, that works fine (if it didn't, what you just told us you did is
> not what you actually did).  You can't pass a pattern with an actual null
to
> re (minor flaw of the implementation, IMO), but the raw string
> r"[\000-\077]" doesn't contain an actual null:  it contains the
4-character
> escape sequence "\000", which re converts to a null.

Must confess I didn't use a raw string even though I said I did :|

I assumed that it wasn't seeing the octal anymore after looking at this.
 >>> r'[\000-\377]'
'[\\000-\\377]'

> Hex escapes work fine too:  r"[\x00-\x3f]" means the same as the above.
I was hoping to see a dump in hex format.

Talked my self into to much work today.
Thanks.
--Darrell






More information about the Python-list mailing list