Sneaky Wombat wrote:
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?
You don't say what you do want. Currently, you have a literal that
describes four characters. Were you tryin
Sneaky Wombat gmail.com> writes:
>
> 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?
'h' is an ascii string. The ascii encoding for '\n' is the number(byte) 0x0A.
When y
Sneaky Wombat wrote:
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?
'\x0a' == '\n'
--
http://mail.python.org/mailman/listinfo/python-list
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
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?
--
http://mail.python.org/mailman/listinfo/python-list