Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'example:': 0.03; 'output': 0.05; 'subject:help': 0.08; 'guys.': 0.09; 'line:': 0.09; 'python': 0.11; '2.7.3': 0.16; '255': 0.16; 'desired:': 0.16; 'excerpt': 0.16; 'meanwhile': 0.16; 'received:74.208.4.195': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'bit': 0.19; 'trying': 0.19; 'input': 0.22; 'header:User-Agent:1': 0.23; 'earlier': 0.24; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'errors': 0.30; 'subject:list': 0.30; "i'm": 0.30; 'work.': 0.31; 'code': 0.31; 'getting': 0.31; 'closer': 0.31; 'disable': 0.31; 'file': 0.32; 'sense': 0.34; 'subject:with': 0.35; 'something': 0.35; 'highway': 0.36; 'library.': 0.36; 'subject:data': 0.36; "i'll": 0.36; 'feedback': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'read': 0.60; 'simply': 0.61; 'simple': 0.61; "you're": 0.61; 'first': 0.61; 'confirm': 0.64; 'here': 0.66; 'received:74.208': 0.68; '100': 0.79; '"big': 0.84; 'want:': 0.84; '212': 0.91; 'aging': 0.91 Date: Thu, 09 May 2013 10:50:45 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: python-list@python.org Subject: Re: help on Implementing a list of dicts with no data pattern References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:QcAOorFi3+dNXLluqwrxb1AZC7vu+uDun8RST9nYykB cdx9RqGR7QhVQHEBqVNQ0x/6O0RAR2Md+Zk/mWHdvdU/w0ZHcp +jz39npnuZQuGLZ0BuWmC2VzjC09K/2WSZhVz99iMgvf5SwdMu 1ch4apS/CwTpLP8FI6D7e8qC1ezxeu59dwZJVXLpE7PSLULNgM 9rwmLCwLlIgUv73GYrQnuPQuT9gL50BDWxnxnghGweCxgpKbuP j2UMBuhOVpoeOfqZuacVsABq+MpWjolszTpek1c40yObeM5/IA N4oHsTFdSSPhp40Dg5x9GAzaDhGn5fKIssuF9PISqnIlPQ69Q= = X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368111061 news.xs4all.nl 15880 [2001:888:2000:d::a6]:46586 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45037 On 05/09/2013 10:33 AM, rlelis wrote: > I apologize once again. > Is my first post here and i'm getting used to the group as long as i get the feedback of my errors by you guys. > I'm using Python 2.7.3 with no dependencies, i'm simply using the standard > library. > Here is the "big picture" of the scenario(i have added it in the pastebin link too) > > FILE OUTPUT DESIRED: > aging: > aging |total |age > aging |0 |100 > aging |2 |115 > aging |3 |1 > aging |4 |10 > > highway: > highway | lanes | state | limit(mph) > highway | 4 | disable | 25 > highway | 2 | disable | 245 > highway | 3 | disable | 125 > highway | 2 | enable | 255 > highway | 3 | disable | 212 > highway | 8 | disable | 78 > > FILE INPUT EXCERPT EXAMPLE: > aging 0 100 > aging 2 115 > aging 3 1 > highway 4 disable 25 > highway 2 disable 245 > highway 0 enable 125 > > Meanwhile i have change the code a little bit and achieve a output closer to what i want: You're still missing the file read code. My earlier assumption that it was a simple readlines() was bogus, or the line: if "aging" in file-content: would never work. Perhaps you have something like: infile = open("xxxx","r") file_content = [line.split() for line in infile] if you confirm it, I'll try to go through the code again, trying to make sense of it. -- DaveA