Re: [Tutor] Iterate through dictionary values and remove item

2008-05-17 Thread Ricardo Araoz
Kent Johnson wrote: On Thu, May 15, 2008 at 12:58 PM, GTXY20 <[EMAIL PROTECTED]> wrote: I suspect that I need to get a better handle on the difference between items() and iteritems() and what situations would call for them respectively. items() returns a list, iteritems() returns an iterator.

Re: [Tutor] Iterate through dictionary values and remove item

2008-05-15 Thread Kent Johnson
On Thu, May 15, 2008 at 12:58 PM, GTXY20 <[EMAIL PROTECTED]> wrote: > I suspect that I need > to get a better handle on the difference between items() and iteritems() and > what situations would call for them respectively. items() returns a list, iteritems() returns an iterator. If you don't actua

Re: [Tutor] Iterate through dictionary values and remove item

2008-05-15 Thread GTXY20
Hi Kent and Bob, Bob sorry about the previous code snippet (was late) - I had previously been trying to accomplish with the following: for k,v in d.items(): u=k[0] b=k[1] if 'a' in v: for k,v in d.items(): if k[0] == u: for vals in v:

Re: [Tutor] Iterate through dictionary values and remove item

2008-05-15 Thread Kent Johnson
On Thu, May 15, 2008 at 2:40 AM, GTXY20 <[EMAIL PROTECTED]> wrote: > Hello all, > > I have dictionary like the following: > > d={(1,23A):[a,b,c,d], (1,24A):[b,c,d], (2,23A):[a,b], (2,24A):[a,b,c,d]} > > I would like to iterate through the dictionary such that if it finds > the value 'a' in the val

Re: [Tutor] Iterate through dictionary values and remove item

2008-05-15 Thread bob gailer
GTXY20 wrote: Hello all, I have dictionary like the following: d={(1,23A):[a,b,c,d], (1,24A):[b,c,d], (2,23A):[a,b], (2,24A):[a,b,c,d]} I would like to iterate through the dictionary such that if it finds the value 'a' in the values of the key that it would remove the value 'b' from the value

[Tutor] Iterate through dictionary values and remove item

2008-05-14 Thread GTXY20
Hello all, I have dictionary like the following: d={(1,23A):[a,b,c,d], (1,24A):[b,c,d], (2,23A):[a,b], (2,24A):[a,b,c,d]} I would like to iterate through the dictionary such that if it finds the value 'a' in the values of the key that it would remove the value 'b' from the values list. In addit