How to insert in a string @ a index

David wizzardx at gmail.com
Sat Sep 8 14:21:29 EDT 2007


> 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]

Or use string formatting:

t1 = "your text bla bla %s bla bla bla %s bla bla" % (string1, string2)



More information about the Python-list mailing list