On Thu, Oct 12, 2017, Iranna Mathapati wrote:
>

>Hi Team,
>
>
>How to replace multipal char from string and substitute with new char with
>one line code
>
>Ex:
>
>str = "9.0(3)X7(2) "  ===========>  9.0.3.X7.2
>
>need to replace occurrence of '(',')' with dot(.) chars
>
>output:
>
> 9.0.3.X7.\



My first gut response was to key on the words "replace" and "string"
and think there is a very handy method already existing that can
help with that.   It would be one line of code, if you don't mind having
wo function calls in that one line of code.

If you want only one function call and you want to do even more
substitutions than just those below, there is another handy functionin the
string object that can do so very nicely.

What did you try?

Roger Christman
Pennsylvania State University
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to