Okay, I understand now. Thanks!
Ken
Steve Willoughby wrote:
On Thu, Mar 11, 2010 at 10:32:45AM -0500, Ken G. wrote:
list = ['physics', 'chemistry', 1997, 2000]
This is a list of 4 elements, and lists allow elements to
be changed, so
list[2] = 2010
Will change the value of list to be ['physics','chemistry',1997,2010]
line = [2010020820841134]
Is this one right, or did you mean '2010020820841134'? What is shown is
a list of one element. Assuming you meant it to be a string, that would
give the error you quote below.
Strings are immutable objects, meaning that once they are created you can't
change them, although you can construct new strings from them, so if you
wanted to make a string which had characters 9 and 10 replaced with "08"
you could say:
line = line[:9]+"08"+line[11:]
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor