擅长:python、mysql、java
<p>您的函数示例:</p>
<pre><code>def strip_list(the_list):
return [line.strip() for line in the_list]
lines = ['foo\n', 'bar\r\n', 'baz']
stripped_list = strip_list(lines)
print(stripped_list)
</code></pre>
<p>将输出:</p>
^{pr2}$
<hr/>
<p>这里作为一个丑陋的内存低效的一行代码,只是为了显示使用<code>splitlines()</code>:)</p>
<pre><code>return ''.join(csvreaderlist).splitlines()
</code></pre>