"Phill Atwood" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > def csv_it(): > db = [] # the entire database of records > rec = {} # a single rec: a dictionary of field names and data pairs
Move this line > fields = [] # list of field names collected so far for current record > for line in open(inputfile): to here > kword = getkeyword(line) # get keyword (or field name) ... > # Now clear current record > fields = [] > rec.clear() and delete this > dummylist = [] and I think you will have what you want (or close). The initial fields = [] line could be moved also, I believe, without thoroughly reading your code. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list