If I have a dictionary {key: [abccd]} and I want to print only unique values corresponding to each key (In this case, (A, B, D)) apart from looping and counting it through each element, what is the most effective way to do this?
if the elements are sorted according to your example; You can use it:
Add "" to itertools, which import groups from the print (group for [k, group (d ['key']) if lane (list (Group)) == 1]) # - & gt; A bd
No comments:
Post a Comment