擅长:python、mysql、java
<p>最简单的方法就是执行当前正在执行的操作,然后执行<code>str.join()</code>以立即“连接”整个列表,顺序如下:</p>
<pre><code>for i in seq.text:
if i.startswith('_'):
second_list.append(i)
# to more closely resemble the output you put in your question,
# you might want to only append the part up to the first whitespace:
# second_list.append(i.split()[0])
else:
first_list.append(i)
first_string = ''.join(first_list)
second_string = ''.join(second_list)
</code></pre>
<p>使用空字符串作为分隔符意味着它们直接连接在一起,中间没有任何内容。您还可以使用其他任何东西作为分隔符—逗号<code>','</code>、空格<code>' '</code>、换行符<code>'\n'</code>,或任何组合,具体取决于所需的输出</p>