Convert generator object to list for debugging [duplicate]
Simply call list on the generator. lst = list(gen) lst Be aware that this affects the generator which will not return any further items. You also cannot directly call list in IPython, as it conflicts with a command for listing lines of code. Tested on this file: def gen(): yield 1 yield 2 yield 3 … Read more