Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45050
| Date | 2013-05-09 14:19 -0400 |
|---|---|
| From | Dave Angel <davea@davea.name> |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1500.1368123592.3114.python-list@python.org> (permalink) |
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