os.walk question

Terry Reedy tjreedy at udel.edu
Sat Jul 26 18:24:04 EDT 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