[Tutor] File mode r+
shitizb at yahoo.com
Fri Sep 30 23:43:58 CEST 2005
Thats strange. Maybe me being on windows makes the
Here is the exact IDLE session to clarify:
IDLE 1.1 ==== No Subprocess ====
I find this very very strange.
--- "Michael P. Reilly" <arcege at gmail.com> wrote:
> On 9/27/05, Shitiz Bansal <shitizb at yahoo.com> wrote:
> > Hi,
> > thanx..it works fine. As for the structure of the
> > file...i decided to pad every line with extra
> > to make the length of each line constant.That way
> > can replace any line with another without being
> > bothered about the number of characters.
> > However my curiosity got better of me again...:D.
> > i tried to insert a /b character(i had a notion it
> > represents backspace) to see if it would work.
> > It inserted a bit of unicode in the file(Mind you,
> > inserted . Not replaced)
> > original file:
> > 'abcd\nefgh\nijkl\nmnop\nqrst'
> > code::
> > file1=open("aa.txt",'r+')
> > file1.readline()
> > file1.seek(0,1)
> > file1.write("1234\b")
> > file1.close()
> > newfile:
> > 'abcd\n1234\x08\nijkl\nmnop\nqrst'
> > How does that come to pass?
> I didn't get what you got exactly. I got:
> \012 => \n and
> \010 => \b (\x08)
> I'm not sure why you would have gotten '\x08\n' in
> the same sequence. Maybe
> you should look again. Incidently, when I try to
> print aa.txt, I get:
> which is what I would expect.
> There's so many different worlds,
> So many different suns.
> And we have just one world,
> But we live in different ones.
Yahoo! Mail - PC Magazine Editors' Choice 2005
More information about the Tutor