"Phill Atwood" <fakeaddress at nowhere.org> wrote in message news:WosTe.9302$vN.460573 at news20.bellglobal.com... > 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4