function return

Beema Shafreen beema.shafreen at gmail.com
Thu Sep 11 08:44:16 EDT 2008


hi all,

I have a script using functions , I have a problem in returning the result.
My script returns only one line , i donot know where the looping is giving
problem, Can any one suggest, why this is happening and let me know how to
return all the lines

def get_ptm():
    fh = open('file.txt',    'r')
       data_lis = []
       for line in fh.readlines():
           data = line.strip().split('\t')
           id = data[0].strip()
           gene_symbol = data[1].strip()
           ptms = data[8].strip()
           result = "%s\t%s\t%s" %(id,gene_symbol,ptms)
           return result
     fh.close()

-- 
Beema Shafreen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080911/891791ac/attachment.html>


More information about the Python-list mailing list