pass python lists tp methods
<p>I want to read a file and create a list from one of its columns by split() method and pass on this list to another method. Can someone explain what is the most pythonic way to achieve that ??</p>

<pre><code>def t(fname):
     k = []
     with open(fname, 'rU') as tx:
         for line in tx:
             lin = line.split()
             k.append(lin[1])
             res = anno(k)
             for id in res.items():
                  if i &gt; 0.05:
                      print(i)
</code></pre>

<p>I want to pass elements of 'k' as one list to anno() method. But in this way, I have number of lists but not one (required). </p>

<p>When you want to create a new list, lsit comprehensions ate the prefered way:</p>

<pre><code>def t(fname):
 with open(fname, 'rU') as tx:
     k = [(line.split())[1] for line in tx]
     res = anno(k)
     for i in res.items():
         if i &gt; 0.05:
             print(i)
</code></pre>

python list methods