When is it appropriate to use dict.items() vs dict.iteritems. Both
seem to work for something like:
for key,val in mydict.items():
print key,val
for key,val in mydict.iteritem s():
print key,val
Also, when is it appropriate to use range() vs xrange(). From my
understanding, xrange() essentially gives you an iterator across a
range, so it should be used when iterating. Should you...
Search Result
Collapse
2 results in 0.0039 seconds.
Keywords
Members
Tags
-
dict.items() vs dict.iteritems and similar questions
-
iteritems() and enumerate()
Python has iteritems() and enumerate() to be used in for loops.
can anyone tell me what these are by themselves, if anything?
are they just for idiom?
thanks.
Xah
xah@xahlee.org
http://xahlee.org/PageTwo_dir/more.html...