On Aug 18, 11:44 am, TYR <[EMAIL PROTECTED]> wrote:
> That sounds like a solution. I think the core of the question is as
> follows; if I was to call the dict() function for each line, thus
> creating a dictionary, and then rename it to dict['name'], will there
> be a namespace collision on the nex
That sounds like a solution. I think the core of the question is as
follows; if I was to call the dict() function for each line, thus
creating a dictionary, and then rename it to dict['name'], will there
be a namespace collision on the next loop when dict() is called again?
Obviously the first dict
On Aug 17, 3:43 pm, TYR <[EMAIL PROTECTED]> wrote:
> > So the tougher problem seems to be parsing those lines. That is not a
> > valid Python dictionary unless the names `Bob`, `Humboldt`, `red`, and
> > `predatory` are not already defined. So you can't just ``eval`` it.
>
> In what way? {'key':
On Aug 17, 7:38 am, TYR <[EMAIL PROTECTED]> wrote:
> I'd like to do something like this; iterate through a file which
> consists of data stored in dictionary format, one dict on each line,
> and read each line into a new dict using one of the values in the dict
> as its name...
>
> for example:
>
>
> So the tougher problem seems to be parsing those lines. That is not a
> valid Python dictionary unless the names `Bob`, `Humboldt`, `red`, and
> `predatory` are not already defined. So you can't just ``eval`` it.
In what way? {'key': val}, right?
Anyway, I can always change the format they g
On Fri, 17 Aug 2007 12:38:16 +, TYR wrote:
> I'd like to do something like this; iterate through a file which
> consists of data stored in dictionary format, one dict on each line,
> and read each line into a new dict using one of the values in the dict
> as its name...
Store the dictionaries
On Aug 17, 7:38 am, TYR <[EMAIL PROTECTED]> wrote:
> I'd like to do something like this; iterate through a file which
> consists of data stored in dictionary format, one dict on each line,
> and read each line into a new dict using one of the values in the dict
> as its name...
>
> for example:
>
>
I'd like to do something like this; iterate through a file which
consists of data stored in dictionary format, one dict on each line,
and read each line into a new dict using one of the values in the dict
as its name...
for example:
stuff = open('data.txt')
for eachLine in stuff:
name{}
nam