擅长:python、mysql、java
<ol>
<li>声明你的代码。在</li>
<li>对特殊字符使用<strong>raw</strong>格式。在</li>
<li>在字符串上正确迭代:在进入下一个循环迭代时保留每次循环迭代的更改。在</li>
</ol>
<p>以下是完成任务的代码:</p>
<pre><code>\# -*- coding: utf-8 -*-
umlautdict = {
'ae': r'ä',
'ue': r'ü',
'oe': r'ö'
}
print umlautdict
inputword = "haer ueber loess"
for item in umlautdict.keys():
inputword = inputword.replace(item, umlautdict[item])
print inputword
</code></pre>
<p>输出:</p>
^{pr2}$