In Python3, many methods return iterator or generator objects (instead of lists or other heavy objects in python2).
However, I found that the split line still returns list
instead of generator
or iteator
:
~$ python3 Python 3.2.2 (...) >>> type('abc d'.split()) <class 'list'>
Is there a buildin to split the string using generator
or iterator
?
(I know that we can split it into ourselves and write a good generator function. I'm curious if there is anything in the standard library or language for this)
source share