trouble with replace
f pemberton
fpemberton133 at yahoo.com
Sat Aug 12 12:49:50 EDT 2006
I have a string (xdata) and theres a newline after every 17 characters
of the string. I was wondering how I can replace multiple substrings
multiple times within a string? To put it another way, this is what i
want to do.
Substring to find ("abcdef") replace it with ("highway")
search again, substring to find ("defgef") replace it with
("news").Search again and find ("effwer") replace it with
("monitor").Example string to search under is '''defgefabcdefyuuuu
effwerbyuuuterrfr'''
I've tried using replace but its not working for me.
xdata.replace('abcdef', 'highway')
xdata.replace('defgef', 'news')
xdata.replace('effwer', 'monitor')
Basically I would want to get the output of "newshighwayyuuuu
monitorbyuuuterrfr"
Thanks, any help would be appreciated.
More information about the Python-list
mailing list