Consume nested generators

Consume nested generators

Suppose I have an arbitrarily nested list in which some of the nested elements can be generators. For example:

Suppose I have an arbitrarily nested list in which some of the nested elements can be generators. For example:

nested_gens = [
    [1, [2, [3, 4]]],
    [2, (map(int, '123'))],
    [3, (map(str, range(i+1)) for i in range(2))]
]

How can I recursively go through this structure and consume all the generator objects?

My desired output is:

[
    [1, [2, [3, 4]]], 
    [2, [1, 2, 3]], 
    [3, [['0'], ['0', '1']]]
]

A solution to this question could be generalized for pickling objects that contain generators. All the answers I've found for dealing with TypeError: can't pickle generator objects don't deal with nested generators.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Top Python Development Companies | Hire Python Developers

After analyzing clients and market requirements, TopDevelopers has come up with the list of the best Python service providers. These top-rated Python developers are widely appreciated for their professionalism in handling diverse projects. When...

Python GUI Programming Projects using Tkinter and Python 3

Python GUI Programming Projects using Tkinter and Python 3

Guide to Python Programming Language

Guide to Python Programming Language