Python Forum
list call problem in generator function using iteration and recursive calls
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
list call problem in generator function using iteration and recursive calls
#2
I'm not sure what you're asking. It looks like asking for an element of your generator (can you post the generator code?) already gives you exactly what you want. If you put it in a list, it adds another layer of list (a second set of brackets).

So don't put it in the list and you should be good.

Can you give more information why print(next(gen)) # gives ==> [4, 2] isn't sufficient?
Reply


Messages In This Thread
RE: list call problem in generator function using iteration and recursive calls - by bowlofred - Oct-24-2020, 09:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem in using generator akbarza 2 545 Nov-07-2023, 08:40 AM
Last Post: perfringo
  for loops break when I call the list I'm looping through Radical 4 903 Sep-18-2023, 07:52 AM
Last Post: buran
  with open context inside of a recursive function billykid999 1 584 May-23-2023, 02:37 AM
Last Post: deanhystad
  How do I call sys.argv list inside a function, from the CLI? billykid999 3 796 May-02-2023, 08:40 AM
Last Post: Gribouillis
  Problem with "Number List" problem on HackerRank Pnerd 5 2,124 Apr-12-2022, 12:25 AM
Last Post: Pnerd
  List Iteration Help javeeva 2 1,194 Feb-07-2022, 11:23 PM
Last Post: snippsat
  asyncio calls within sync function ( Websocket on_open) orion67 0 1,421 Jan-16-2022, 11:00 AM
Last Post: orion67
  Problem With Database Calls and Load Timbo03 1 2,132 Nov-21-2021, 10:48 AM
Last Post: Timbo03
  Tuple generator, and function/class syntax quazirfan 3 3,897 Aug-10-2021, 09:32 AM
Last Post: buran
  Why recursive function consumes more of processing time than loops? M83Linux 9 4,274 May-20-2021, 01:52 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020