fork(3) download
  1. import re
  2. text = "a,b,{'c','d','e','f'},g,h"
  3. print(re.sub(r"{[^{}]+}", lambda x: x.group(0).replace(",", ";"), text))
Success #stdin #stdout 0.02s 9984KB
stdin
Standard input is empty
stdout
a,b,{'c';'d';'e';'f'},g,h