in

for

for i in range ( 0 , len ( l ) , n ) :

not

if

if not os . path . exists ( directory ) :

as

with

with open ( path , 'w' ) as f: