empty clause of for loops

Sven R. Kunze srkunze at mail.de
Fri Mar 18 16:49:21 EDT 2016


On 18.03.2016 20:10, Palpandi wrote:
> You can do like this.
>
> if not my_iterable:
>      <do something>
> for x in my_iterable:
>      <do something>

Thanks for you help here, however as already pointed out, my_iterable is 
not necessarily a list but more likely an exhaustible iterator/generator.

Best,
Sven



More information about the Python-list mailing list