How to convert one list into generator?

0 votes

I am new in generator concept. I tried to implement lazy execution concept. Can anyone help me with an example how to use list as a generator?

Apr 23 in Python by akhtar
• 11,270 points

1 answer to this question.

0 votes


Say, you have one list A. Now convert this list into generator using iter function.

>>>A = [1,2,3,4,5,6]
>>>gen = iter(A)

To check you can use next function.

answered Apr 23 by MD
• 24,500 points

Related Questions In Python

0 votes
1 answer

How to convert each list item into string in a column of data frame. ?

Hey, To split a string you can use ...READ MORE

answered Feb 5 in Python by Roshni
• 600 points
0 votes
1 answer

How can I convert a list of dictionaries from a CSV into a JSON object in Python?

You could try using the AST module. ...READ MORE

answered Apr 17, 2018 in Python by anonymous
0 votes
1 answer

How to split a string into a list?

You can use the function  text.split() This should be ...READ MORE

answered Jul 30, 2018 in Python by Priyaj
• 57,530 points
+1 vote
2 answers

How to convert list to string

mylist = [1, 2, 3] ‘’.join(map(str, mylist)) ==> ...READ MORE

answered Aug 21, 2018 in Python by Omkar
• 69,060 points
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 963 views
0 votes
0 answers
+4 votes
6 answers
0 votes
1 answer

How to convert a dataframe into list?

Hi@akhtar, You can convert your dataframe into list. ...READ MORE

answered Apr 24 in Python by MD
• 24,500 points
0 votes
1 answer

How to convert sqlite format to CSV format?

Hi@akhtar, If you want to read SQLite format ...READ MORE

answered Feb 11 in Python by MD
• 24,500 points