removing subset dict within list


this unequivocally wholly easy explain an example, mislay intersection list within dict i wholly something this:



a = {1:'', 2:'', 3:'', 4:''}
exclusion = [3, 4, 5]

# have build adult new list iteration breaks
toremove = []
for var a.iterkeys():
var exclusion:
toremove.append(var)

for var toremove:
del a[var]


this competence seem an surprising example, nonetheless it's extraordinary array times i've something this. doing sets many nicer, nonetheless i clearly wish keep 'values' dict.



this slight irritating since requires twin loops an additional array. there cleaner some-more fit proceed doing this.



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members