On Tue, Mar 17, 2009 at 12:12 PM, Anjanesh Lekshminarayanan <m...@anjanesh.net> wrote: >>>> a = ['cat','dog','elephant'] >>>> a.next() > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: 'list' object has no attribute 'next' >>>> > Is there something that imtates PHP's next() ? (http://php.net/next)
>>> b = a.__iter__() >>> b.next() 1 >>> b.next() 2 However, in many cases the more Pythonic way of working will be to use a for-loop (which is like a foreach-loop in PHP and other languages). -- André Engels, andreeng...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list