擅长:python、mysql、java
<p>正如你所说:</p>
<blockquote>
<p>"training" is a variable I have previously assigned inside a function
(i.e. this is to be ignored),</p>
</blockquote>
<p>所以我给你的解决方案是:</p>
<blockquote>
<p>I'm not quite sure how to grab and "join" all of this (past the point
of opening the file and having a for loop for each line):</p>
</blockquote>
<p>您可以尝试:</p>
<p>这只是一个示例,您可以根据需要进行修改:</p>
<pre><code>import ast
with open('file.txt','r') as f:
for line in f:
print(*ast.literal_eval(line))
</code></pre>
<p>将为您提供输出:</p>
<pre><code>Animals Endoplasmic Reticulum Humans
</code></pre>
<p>你可以检查它的类型</p>
<pre><code>print(type(ast.literal_eval(line)))
</code></pre>
<p>即:</p>
<pre><code><class 'list'>
</code></pre>
<p>所以你可以根据你的要求对这个做所有的列表操作。你知道吗</p>