conditional for-statement

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Mon Aug 24 15:07:58 CEST 2009


seb a écrit :
> Hi,
> 
> i was wondering if there is a syntax alike:
> 
> for i in range(10) if i > 5:
>     print i
> 
> equivalent to
> 
> for i in (for i in range(10) if i>5):
>     print i

what about :

for i in range(6, 10):
     print i

<g>


More seriously:

for i in range(10):
     if i > 5:
         print i



More information about the Python-list mailing list