|
From: Kent J. <ke...@td...> - 2005-09-21 14:56:08
|
Ivan Hernandez wrote:
> Hello... i have this problem:
>
> ihernandez@cinemasoft:~/documentos/src/jserver$ jython
> Jython 2.1 on java1.4.2-02 (JIT: null)
> Type "copyright", "credits" or "license" for more information.
>
>>>>x = {}
>>>>print x
>
> {}
>
>>>>for i in x:
>
> ... print i
> ...
> Traceback (innermost last):
> File "<console>", line 1, in ?
> TypeError: loop over non-sequence
>
> But in python it works fine.
> How can i loop items ??
Use
for i in x.keys():
or jython 2.2 alpha; direct iteration over dicts was added in Python 2.2.
Kent
|