擅长:python、mysql、java
<pre><code>import sys
import time
data = ["b","u","f","f","e","r","i","n","g"]
# display with one upper char
for x in range(len(data)):
# remeber lower char
old = data[x]
# replace with upper char
data[x] = old.upper()
# create full text
text = "".join(data)
# display full text
sys.stdout.write("\r")
sys.stdout.write(text)
sys.stdout.flush()
# put back lower char
data[x] = old
time.sleep(1)
# display without upper chars at the end
text = "".join(data)
sys.stdout.write("\r")
sys.stdout.write(text)
sys.stdout.flush()
</code></pre>
<p>如果你不需要把多余的代码放在cd2}后面。在</p>
<p>您也可以在开始处放置空字符串,以显示第一个不带大写字符的文本。在</p>
^{pr2}$