I have this generator which returns a list of numbers.
li=tile_generator(im)
I need to find the length of the list "li" as I need to check for a threshold value.
I used length = sum(1 for i in li)
. It is returning the length of the list but the elements in the generator are exhausted as it is a generator.
I need to return the length without exhausting the elements in the generator.