星期五, 十月 12, 2007

python iterator 的一种用法

>>> d = {'a' : 1, 'b' : 2, 'c' : 3, 'd' : 4}
>>> it = iter(d)
>>> for x in it: print x
...
a
c
b
d

没有评论: