1import re
2s = "Example String"
3replaced = re.sub('[ES]', 'a', s)
4print replaced
1import re
2
3s = 'aaa@xxx.com bbb@yyy.com ccc@zzz.com'
4
5print(re.sub('[a-z]*@', 'ABC@', s))
6# ABC@xxx.com ABC@yyy.com ABC@zzz.com
7
1s = 'one two one two one'
2
3# 1st argument: string to find
4# 2nd argument: string to put in place
5
6print(s.replace(' ', '-')) # one-two-one-two-one