How to loop through a generator January 8, 2023 by Tarik Simply for x in gen: # whatever will do the trick. Note that if gen always returns True.