On 11/11/2016 05:29 PM, subhabangal...@gmail.com wrote:
I have a string
"Hello my name is Richard"
I want to identify the match of 'Hello' and 'Richard'
in list, and replace them with 'Hello/Hi" and 'Richard/P'
respectively.
The result should look like,
"Hello/Hi my name is Richard/P".
Simple replace method may not work.
Why would simple replace not work? I.e. what's wrong with this?
s = '"Hello my name is Richard"'
s.replace("Hello", "Hello/Hi").replace("Richard", "Richard/P")
I mean maybe you can't use that, but if you can't use that, then I'm
probably not understanding your question.
Cheers,
Thomas
--
https://mail.python.org/mailman/listinfo/python-list