Steven D'Aprano added the comment:
You wrote:
> There are 6 bytes not 4 and where did the c3, bd, and c2 come from?
In Python 2, strings are byte strings, in Python 3, strings by default are
Unicode text strings. You are seeing the UTF-8 representation of the text
string.
py>
New submission from Nathan Benson :
While writing some shellcode I uncovered an unusual bug where Python 3 seems to
print out incorrect (and extra) hex bytes using the print statement with \x.
Needless to say I was pulling my hair out trying to figure out why my shellcode
wasn’t working.