Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Neil Cerutti Newsgroups: comp.lang.python Subject: Re: help on Implementing a list of dicts with no data pattern Date: 9 May 2013 13:08:56 GMT Organization: Norwich University Lines: 31 Message-ID: References: <826082ef-43e2-4835-8621-6ef677eb922c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: individual.net i+qWVbnoVScWd0QaFF8NRAlos7OwhwnP9B4dUraAOzz7oOkQCM Cancel-Lock: sha1:wdcP7q7sWKqMYz6d33WDuXxbN4A= User-Agent: slrn/0.9.9p1/mm/ao (Win32) Xref: csiph.com comp.lang.python:45033 On 2013-05-09, rlelis wrote: > This is what i have for now: > > highway_dict = {} > aging_dict = {} > queue_row = [] > for content in file_content: > if 'aging' in content: > # aging 0 100 > collumns = ''.join(map(str, content[:1])).replace('-','_').lower() > total_values =''.join(map(str, content[1:2])) > aging_values = ''.join(map(str, content[2:])) > > aging_dict['total'], aging_dict[collumns] = total, aging_values > queue_row.append(aging_dict) > > if 'highway' in content: > #highway | 4 | disable | 25 > collumns = ''.join(map(str, content[:1])).replace('-','_').lower() > lanes_values =''.join(map(str, content[1:2])) > state_values = ''.join(map(str, content[2:3])).strip('') > limit_values = ''.join(map(str, content[3:4])).strip('') > > highway_dict['lanes'], highway_dict['state'], highway_dict['limit(mph)'] = lanes, state, limit_values > queue_row.append(highway_dict) Can you provide a short example of input and what you had hoped to see in the lists and dicts at the end? -- Neil Cerutti