I have to substitute a range of accented characters in a string with the respective non accented letters.
I was thinking of using re.sub but I have no clue of how to substitute more items (each one with a different item) at the same time.
So to be clearer:
import re
re.sub(r'è|ù|ò|à','e,u,o,a',string).
First of all is this allowed in Python so to avoid to make a separate line for each letter?
Thanks!
re.sub()can accept a function as the replacement, so you can do something like the following:Example: