slicing functionality for strings / Python suitability for bioinformatics
reinhold-birkenfeld-nospam at wolke7.net
Mon Sep 19 21:43:34 CEST 2005
jbperez808 at yahoo.com wrote:
> Traceback (most recent call last):
> File "<pyshell#119>", line 1, in ?
> 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')
More information about the Python-list