Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

convert list to generator python

data = [1,23,46,9,2]
#creates a generator object
data_gen = (y for y in data)

# creates a list iterator object
data_iter = iter(data)

# both can be used with next()

next(data_gen) 
# or
next(data_iter)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #list #generator #python
ADD COMMENT
Topic
Name
1+5 =