os.walk question

Terry Reedy tjreedy at udel.edu
Sun Jul 27 00:24:04 CEST 2008



Eric Wertman wrote:
> I do this, mabye a no-no?

It is a roundabout way to do multiple assignment:

> import os

> for root,dirs,files in os.walk(dir) : break

root,dirs,files = os.walk(dir).next #2.x
root,dirs,files = next(os.walk(dir))#3.x




More information about the Python-list mailing list