Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45033
| From | Neil Cerutti <neilc@norwich.edu> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: help on Implementing a list of dicts with no data pattern |
| Date | 2013-05-09 13:08 +0000 |
| Organization | Norwich University |
| Message-ID | <av1lf7Fqug0U1@mid.individual.net> (permalink) |
| References | <c27c3eef-44f5-467c-b3a3-119263deb035@googlegroups.com> <826082ef-43e2-4835-8621-6ef677eb922c@googlegroups.com> |
On 2013-05-09, rlelis <ricardo.lelis3@gmail.com> 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
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