user3698773 user3698773 - 1 month ago 5x
Python Question

pass python lists tp methods

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 ??

def t(fname):
k = []
with open(fname, 'rU') as tx:
for line in tx:
lin = line.split()
res = anno(k)
for id in res.items():
if i > 0.05:

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).

def t(fname):
   k = []
   tx = open(fname, 'rU')
   k = [(line.split())[1] for line in tx]
   res = anno(k)
   for i in res.items():
       if i > 0.05:print(i)