CSV

Beema shafreen beema.shafreen at gmail.com
Thu Jan 3 09:09:06 EST 2008


Hi all,

I have written a script to parse a CSV file:
import csv
def get_lines(fname):
    fhandle = csv.reader(open(fname,"rb"))
        for line in fhandle:
        while fhandle.next()[0] == "prot_hit_num":
            continue
        for row in fhandle:
            print  row




result =  get_lines("file.csv")
print result

I need to print the data from "prot_hit_num" and before the line "peptide
sequence".
I am able to print the whole from "prot_hit_num" to the end of the file but
I need to break before line "peptide sequence........". How should i do
this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080103/b7460555/attachment.html>


More information about the Python-list mailing list