Re: [Tutor] how to write a string into a specific line in a file

2006-03-09 Thread Roel Schroeven
Alan Gauld schreef: > To see some examples in MALLARD Basic (one of the ones that > I have used in the past - on CP/M!) look here: > > http://www.fvempel.nl/basic.html > > (Its got German(or Dutch mebbe given the .nl?) variables and comments > but the keywords are in English!) Yep, it's Dutch.

Re: [Tutor] how to write a string into a specific line in a file

2006-03-08 Thread Alan Gauld
>> Some languages, such as COBOL and some BASICs etc support >> random access files, unfortunately Python doesn't > You then go on to mention file.seek(). I thought that seek() provided > "random access", ie. to seek to anywhere at random in a file. Can you > clarify what you mean by "random acce

Re: [Tutor] how to write a string into a specific line in a file

2006-03-08 Thread Danny Yoo
On Wed, 8 Mar 2006, andrew clarke wrote: > On Tue, Mar 07, 2006 at 11:18:27AM -, Alan Gauld wrote: > > > > I was wondering if it is possible to write a string to a specific line > > > in a file without reading in the whole file in as the below. > > > > Some languages, such as COBOL and some

Re: [Tutor] how to write a string into a specific line in a file

2006-03-08 Thread andrew clarke
On Tue, Mar 07, 2006 at 11:18:27AM -, Alan Gauld wrote: > > I was wondering if it is possible to write a string to a specific line > > in a file without reading in the whole file in as the below. > > Some languages, such as COBOL and some BASICs etc support > random access files, unfortunate

Re: [Tutor] how to write a string into a specific line in a file

2006-03-07 Thread Alan Gauld
> I was wondering if it is possible to write a string to a specific line > in a file without reading in the whole file in as the below. Some languages, such as COBOL and some BASICs etc support random access files, unfortunately Python doesn't (Although I'll be amazed if somebody hasn't cooked u

Re: [Tutor] how to write a string into a specific line in a file

2006-03-07 Thread tak
Sorry, I meant lines in line in the below: f = open(filename) lines = f.readlines() f.close() # num for some line number >>lines[num] = "String" f = open(filename) f.writelines(lines) f.close() *** Hello, I was wondering if it is

[Tutor] how to write a string into a specific line in a file

2006-03-07 Thread tak
Hello, I was wondering if it is possible to write a string to a specific line in a file without reading in the whole file in as the below. ___ f = open(filename) lines = f.readlines() f.close() # num for some line number line[num] =