擅长:python、mysql、java
<p>试试这个:</p>
<pre><code>>>> commands = []
>>> a = StringIO.StringIO("RUN aaa\nRUNafas\nRUNaaa\n")
>>> for line in a:
... if line.startswith("RUN"):
... commands.append(line.rstrip())
...
>>> print " \\\n".join(commands)
RUN aaa \
RUNafas \
RUNaaa
</code></pre>