Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45050
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.083 |
| X-Spam-Evidence | '*H*': 0.84; '*S*': 0.00; 'subject:help': 0.08; 'content:': 0.09; 'assume': 0.14; 'likewise': 0.16; 'mange': 0.16; 'nameerror:': 0.16; 'thursday,': 0.16; 'wrote:': 0.18; 'header :User-Agent:1': 0.23; 'earlier': 0.24; 'header': 0.24; 'file.': 0.24; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'rest': 0.29; 'subject:list': 0.30; 'skip:( 20': 0.30; 'code': 0.31; "skip:' 10": 0.31; 'run': 0.32; 'problem': 0.35; 'subject:with': 0.35; 'something': 0.35; 'data,': 0.36; 'representing': 0.36; 'subject:data': 0.36; 'next': 0.36; 'list': 0.37; 'filter': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'read': 0.60; "you'll": 0.62; "you've": 0.63; 'name': 0.63; 'received:74.208': 0.68; 'received:74.208.4.194': 0.84; 'angel': 0.91; '2013': 0.98 |
| Date | Thu, 09 May 2013 14:19:38 -0400 |
| From | Dave Angel <davea@davea.name> |
| 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 | <c27c3eef-44f5-467c-b3a3-119263deb035@googlegroups.com> <5bc1d8b8-61b1-446d-8487-1e72c1ddf925@googlegroups.com> |
| In-Reply-To | <5bc1d8b8-61b1-446d-8487-1e72c1ddf925@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:rNV/pNQdBBHfJ3ZMYsKPQ79094FjsWzwpxnP2o2iG0I MyrDZxYhGv4E6D9ks1w1gq4KPbBwVxZFg7SWkV8fg5ORlYMlz2 xaz23if/7+iiBSEAILqvLWjzSfHSHndZqbJKCDOohenjSW0prl 5SbWAxy6fGq7j6bedR11jB3k9y1dtoL0OSwq2/whdmfnK3sXHw TCPDRE9rjrf3QDYPipnhu4G8w8gi3CCtYG36SgAu5kXCfY4xH6 JMSRejW44OwKgBupnBZgwhnh/1zbHghTb7SIqLwqfgBDoKCgcp 0MXWvub2gEUiG5TJFmAZENMZMHehrg7rJOhCFJJ6TCW4IBuog= = |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1500.1368123592.3114.python-list@python.org> (permalink) |
| Lines | 38 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1368123592 news.xs4all.nl 16001 [2001:888:2000:d::a6]:52648 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:45050 |
Show key headers only | View raw
On 05/09/2013 12:14 PM, rlelis wrote:
> On Thursday, May 9, 2013 12:47:47 AM UTC+1, rlelis wrote:
> @Dave Angel
> this is how i mange to read and store the data in file.
> data = []
> # readdata
> f = open(source_file, 'r')
> for line in f:
> header = (line.strip()).lower()
> # conditions(if/else clauses) on the header content to filter desired data
> data.append(header)
>
From earlier message:
> highway_dict = {}
> aging_dict = {}
> queue_counters={}
> queue_row = []
> for content in file_content:
if 'aging' in content:
So your data is a list of strings, each representing one line of the
file. When you run this, you'll get something like:
NameError: name 'file_content' is not defined
If I assume you've just neglected to include the assignment,
file_content = data, then the next problem is
if 'aging' in content:
will never fire. Likewise
if 'highway' in content:
will never fire. So the rest of the code is irrelevant.
--
DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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