On 10 янв, 23:40, John Machin <sjmac...@lexicon.net> wrote: > On Jan 11, 2:45 am, "sim.sim" <maksim.kasi...@gmail.com> wrote: > > > > > Hi all! > > > 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: > > > >>> open("test", "w").write('before\x1aafter') > > >>> open('test').read() > > > 'before\x1aafter' > > > but for my WinXP box, it gives some strange: > > > >>> open("test", "w").write('before\x1aafter') > > >>> open('test').read() > > > 'before' > > > 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? > > You've already got two good answers, but this might add a little more > explanation: > > You will aware that in Windows Command Prompt, to exit the interactive > mode of Python (among others), you need to type Ctrl-Z ... > > | C:\junk>python > | Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit > (Intel)] on > win32 > | Type "help", "copyright", "credits" or "license" for more > information. > | >>> problem = '\x1a' > | >>> ord(problem) > | 26 > | >>> # What is the 26th letter of the English/ASCII alphabet? > | ... > | >>> ^Z > | > | C:\junk> > > HTH, > John
Hi John, I agree - those two answers are really good. Thanks to Mel and Marc. I'm sorry if my stupid question was annoyed you. -- Maksim -- http://mail.python.org/mailman/listinfo/python-list