Steven D'Aprano wrote:
> b = set(B)
> for key, values in A.items():
> A[key] = list( set(values).difference(b) )
>
>
> For Python 3, you will need to change the call A.items() to
> list(A.items()), but otherwise they should be the same.
The documentation doesn't say so explicitly, see
http
ranjan das wrote:
I have the following information
A={'g2': [4,5,3], 'g1': [1, 3]}
B=[2,3,5]
Now I want to remeove the elements in B if they are present (as values) in
dictionary A.
My expected solution is
A= {'g2': [4], 'g1': [1] }
Do you care about the order of the elements in A's value
On Fri, Apr 1, 2011 at 9:52 AM, ranjan das wrote:
> I have the following information
>
> A={'g2': [4,5,3], 'g1': [1, 3]}
>
> B=[2,3,5]
>
> Now I want to remeove the elements in B if they are present (as values) in
> dictionary A.
>
> My expected solution is
>
> A= {'g2': [4], 'g1': [1] }
>
> I wro
ranjan das wrote:
> I have the following information
>
> A={'g2': [4,5,3], 'g1': [1, 3]}
>
> B=[2,3,5]
>
> Now I want to remeove the elements in B if they are present (as values) in
> dictionary A.
>
> My expected solution is
>
> A= {'g2': [4], 'g1': [1] }
>
> I wrote the following piece of
I have the following information
A={'g2': [4,5,3], 'g1': [1, 3]}
B=[2,3,5]
Now I want to remeove the elements in B if they are present (as values) in
dictionary A.
My expected solution is
A= {'g2': [4], 'g1': [1] }
I wrote the following piece of code which gives me thhe right code, but I am
s