Just posting this so I can search for it later, as it always seems to stump me:
$ python3.2 Python 3.2 (r32:88445, Oct 20 2012, 14:09:50) [GCC 4.5.2] on lin
If we take a look at the source for bytes.__repr__, it looks as if the b'' is baked into the method.
b''
The most obvious workaround is to manually slice off the b'' from the resulting repr():
repr()
>>> x = b'\x01\x02\x03\x04' >>> print(repr(x)) b'\x01\x02\x03\x04' >>> print(repr(x)[2:-1]) \x01\x02\x03\x04