"Reinhold Birkenfeld" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] wrote: >>>>> rs='AUGCUAGACGUGGAGUAG' >>>>> rs[12:15]='GAG' >> Traceback (most recent call last): >> File "<pyshell#119>", line 1, in ? >> rs[12:15]='GAG' >> TypeError: object doesn't support slice assignment >> >> You can't assign to a section of a sliced string in >> Python 2.3 and there doesn't seem to be mention of this >> as a Python 2.4 feature (don't have time to actually try >> 2.4 yet). > > Strings are immutable in Python, which is why assignment to > slices won't work. > > But why not use lists? > > rs = list('AUGC...') > rs[12:15] = list('GAG')
Or arrays of characters: see the array module. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list