<p>我做错什么了?在</p>
<pre><code>import re
x = "The sky is red"
r = re.compile ("red")
y = r.sub(x, "blue")
print x # Prints "The sky is red"
print y # Prints "blue"
</code></pre>
<p>我怎样才能让它印上“天空是蓝色的”?在</p>
<p>调用<code>sub</code>的参数有错误的取整方式:</p>
<pre>
<code>
import re
x = "The sky is red"
r = re.compile ("red")
y = r.sub("blue", x)
print x # Prints "The sky is red"
print y # Prints "The sky is blue"
</code>
</pre>