how to change the time string into number?

Ian Kelly ian.g.kelly at gmail.com
Wed Aug 13 23:07:27 EDT 2014


On Wed, Aug 13, 2014 at 8:51 PM, YBM <ybmess at nooos.fr.invalid> wrote:
> BTW, why iterators does not have such an index method ?

Because iterators don't support indexing. In order to support such a thing,
it would have to exhaust the iterator.

>>> iter(range(5))[3]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'range_iterator' object is not subscriptable

The only methods you can rely upon an arbitrary iterator to have are
__iter__ and __next__.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140813/132b9ca9/attachment.html>


More information about the Python-list mailing list