"ranjan das" <[email protected]> wrote
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 first thought was to start with the dictionary, something like
for key in A:
A[key] = [val for val in A[key] if val not in B]
Dunno what the efficiency will be like because there are a lot of
hidden
loops going on - but at least they are in C not Python. But I don't
think
it would be much worse than your option...
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor