How to insert in a string @ a index

David wizzardx at gmail.com
Sat Sep 8 14:22:47 EDT 2007


On 9/8/07, David <wizzardx at gmail.com> wrote:
> > The python doesn't supports t1[keyword_index]="XYZhello" (string
> > object assignment is not supported). How do I get to this problem? Any
> > sugguestions?
>
> Build a new string var using slicing. eg:
>
> t1 = t1[:keyword_index] + "XYZhello" + [keyword_index]
>

Typo. Missed a colon. Should be:

t1 = t1[:keyword_index] + "XYZhello" + [keyword_index:]



More information about the Python-list mailing list