我在Python中有一个unicode字符串,基本上需要逐个字符地完成,并根据规则列表替换某些字符串.其中一条规则是将a其改为öif a后n.此外,如果一行中有两个元音字符,它们将被一个元音字符替换:.所以,如果我有字符串"natarook",最简单,最有效的方法是"nötaro:k"什么?如果重要的话,使用Python 2.6和CherryPy 3.1.
a
ö
n
:
"natarook"
"nötaro:k"
编辑:连续两个元音的意思是相同的元音(oo,aa,ii)
python string conditional replace
conditional ×1
python ×1
replace ×1
string ×1