On 6/25/2010 1:20 PM Sneaky Wombat said...
Why is python turning \x0a into a \n ?

In [120]: h='\x0a\xa8\x19\x0b'

In [121]: h
Out[121]: '\n\xa8\x19\x0b'


I don't want this to happen, can I prevent it?



It's not happening. What you're seeing is the representation of the four bytes, and \x0a _is_ \n and python displays the common form to assist interpretation.

What you can do is write a display function to suit your needs if it makes a difference.

\x48\x54\x48\x2c

Emile

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to