0

I want to replace multiple specific character with the function replace for example :

INPUT :(c#d)&(a#b)&(k>m)

output : should be #(c,d)&#(a,b)&(k>m)

but it work only for one input #(c,d)&(a#b)&(k#m)

this is my code

inr=str(input('entrer : '))    

inr = inr.replace('(a#b)','#(a,b)') or inr.replace('(c#d)','#(c,d)')
print(inr)
Community
  • 1
  • 1

1 Answers1

2

You can use replace twice:

inr.replace('#',',').replace('(','#(')

#(c,d)&#(a,b)&#(k,m)
YOLO
  • 20,181
  • 5
  • 20
  • 40