Re: are there some special about '\x1a' symbol
- From: Marc 'BlackJack' Rintsch <bj_666@xxxxxxx>
- Date: 10 Jan 2009 16:08:35 GMT
On Sat, 10 Jan 2009 07:45:53 -0800, sim.sim wrote:
I had touch with some different python behavior: I was tried to write
into a file a string with the '\x1a' symbol, and for FreeBSD system, it
gives expected result:
'before\x1aafter'open("test", "w").write('before\x1aafter') open('test').read()
but for my WinXP box, it gives some strange:
'before'open("test", "w").write('before\x1aafter') open('test').read()
Here I can write all symbols, but not read. I've tested it with python
2.6, 2.5 and 2.2 and WinXP SP2.
Why is it so and is it possible to fix it?
\x1a is treated as "end of text" character in text files by Windows. So
if you want all, unaltered data, open the file in binary mode ('rb' and
'wb').
Ciao,
Marc 'BlackJack' Rintsch
.
- References:
- are there some special about '\x1a' symbol
- From: sim.sim
- are there some special about '\x1a' symbol
- Prev by Date: Re: why cannot assign to function call
- Next by Date: Re: are there some special about '\x1a' symbol
- Previous by thread: are there some special about '\x1a' symbol
- Next by thread: Re: are there some special about '\x1a' symbol
- Index(es):
Relevant Pages
|