"Diana Hawksworth" <[EMAIL PROTECTED]> wrote

> How do I find a particular name, change the score and then save
> the changes back to the text file again??

iterate over the file checking (and modifying) each line
write the line back out:

Pseudo code

Out = open('foo.txt','w')
for line in file('foo.txt'):
    if 'somestring' in line:
       line = 'I changed it\n'
    Out.write(line)

Out.close()

You will find much more on this in my file handling topic in my 
tutorial.


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to