Hi,
I have a dictionary storing many things... I would like to delete entries which have key of len < 3. But after I do the del statement, there are still lots of entries with len < 3, what happens?
for w in fdict.keys()[:]:
if w.strip() in banset or len(w.strip()) < 3 or len(w.strip()) > 25:
del fdict[w]
elif isinstance(w, unicode):
del fdict[w]
for w in fdict.keys():
if len(w) < 3:
print w, len(w)
some sample result of the print statement above:
ld 2
lg 2
lr 2
lv 2
ly 2
l? 2
l? 2
mi 2
mk 2
mt 2
np 2
nr 2
oc 2
oj 2
om 2
oo 2
ou 2
o? 2
p3 2
pl 2
pt 2
ri 2
rn 2
ro 2
sc 2
sf 2
sg 2
sh 2
sk 2
te 2
tt 2
u? 2
vg 2
vv 2
wk 2
x2 2
yu 2
zi 2
?? 2
?? 2
?? 2
?? 2
?& 2
?? 2
?? 2
? 1
? 1
? 1
? 1
? 1
? 1
? 1
Thanks in advance.
Raymond