How to insert in a string @ a index
a.m.
lolu999 at gmail.com
Sun Sep 9 22:15:26 EDT 2007
More information about the Python-list mailing list
Sun Sep 9 22:15:26 EDT 2007
- Previous message (by thread): How to insert in a string @ a index
- Next message (by thread): Modul (%) in python not like in C?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thanks guys for you help. I ended up doing this way (for the
records)...
t1 = "hello world hello. hello. \nwhy world hello"
while index<t1.count("hello"):
if (your condition to determine keyword):
t2=t1[:(index+offset)].replace("hello","XYZhello")+t1[((index
+offset):] # offset is 5 (hello = 5 characters)
index+=1
- Previous message (by thread): How to insert in a string @ a index
- Next message (by thread): Modul (%) in python not like in C?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list