Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44976

help on Implementing a list of dicts with no data pattern

X-Received by 10.224.59.205 with SMTP id m13mr8505490qah.7.1368056867685; Wed, 08 May 2013 16:47:47 -0700 (PDT)
X-Received by 10.49.103.202 with SMTP id fy10mr912056qeb.32.1368056867661; Wed, 08 May 2013 16:47:47 -0700 (PDT)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!l3no3664529qak.0!news-out.google.com!y6ni20871qax.0!nntp.google.com!m7no3713740qam.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Wed, 8 May 2013 16:47:47 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=79.169.203.85; posting-account=Kwz2HQoAAAA1A1vCVTcEyMTTbP-uT1kL
NNTP-Posting-Host 79.169.203.85
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <c27c3eef-44f5-467c-b3a3-119263deb035@googlegroups.com> (permalink)
Subject help on Implementing a list of dicts with no data pattern
From rlelis <ricardo.lelis3@gmail.com>
Injection-Date Wed, 08 May 2013 23:47:47 +0000
Content-Type text/plain; charset=ISO-8859-1
X-Received-Bytes 1942
Xref csiph.com comp.lang.python:44976

Show key headers only | View raw


Hi guys,

I'm working on this long file, where i have to keep reading and
storing different excerpts of text (data) in different variables (list).

Once done that i want to store in dicts the data i got from the lists mentioned before. I want them on a list of dicts for later RDBMs purpose's.

The data i'm working with, don't have fixed pattern (see example bellow), so what i'm doing is for each row, i want to store combinations of  word/value (Key-value) to keep track of all the data.

My problem is that once i'm iterating over the list (original one a.k.a file_content in the link), then i'm nesting several if clause to match
the keys i want. Done that i select the keys i want to give them values and lastly i append that dict into a new list. The problem here is that i end up always with the last line repeated several times for each row it found's.

Please take a look on what i have now:
http://pastebin.com/A9eka7p9

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

help on Implementing a list of dicts with no data pattern rlelis <ricardo.lelis3@gmail.com> - 2013-05-08 16:47 -0700
  Re: help on Implementing a list of dicts with no data pattern Dave Angel <davea@davea.name> - 2013-05-08 20:05 -0400
  Re: help on Implementing a list of dicts with no data pattern MRAB <python@mrabarnett.plus.com> - 2013-05-09 01:16 +0100
  Re: help on Implementing a list of dicts with no data pattern rlelis <ricardo.lelis3@gmail.com> - 2013-05-09 02:57 -0700
    Re: help on Implementing a list of dicts with no data pattern Dave Angel <davea@davea.name> - 2013-05-09 08:26 -0400
    Re: help on Implementing a list of dicts with no data pattern Neil Cerutti <neilc@norwich.edu> - 2013-05-09 13:08 +0000
  Re: help on Implementing a list of dicts with no data pattern rlelis <ricardo.lelis3@gmail.com> - 2013-05-09 07:33 -0700
    Re: help on Implementing a list of dicts with no data pattern Dave Angel <davea@davea.name> - 2013-05-09 10:50 -0400
  Re: help on Implementing a list of dicts with no data pattern rlelis <ricardo.lelis3@gmail.com> - 2013-05-09 09:14 -0700
    Re: help on Implementing a list of dicts with no data pattern Dave Angel <davea@davea.name> - 2013-05-09 14:19 -0400
      Re: help on Implementing a list of dicts with no data pattern rlelis <ricardo.lelis3@gmail.com> - 2013-05-09 14:22 -0700
        Re: help on Implementing a list of dicts with no data pattern Dave Angel <davea@davea.name> - 2013-05-09 18:32 -0400
          Re: help on Implementing a list of dicts with no data pattern Neil Cerutti <neilc@norwich.edu> - 2013-05-10 12:54 +0000

csiph-web