Breaking out of walk()

Gerrit Holl gerrit.holl at pobox.com
Sun Jan 16 15:59:18 EST 2000


Fredrik Lundh wrote on 948051871:
> Gerrit Holl <gerrit.holl at pobox.com> wrote:
> > Robert Roy wrote on 948036970:
> > > if 'cvs' in names: names.remove('cvs')
> > > 
> > > will skip over directories named 'cvs'
> > 
> > It won't:
> > >>> l = ['foo', 'cvs', 'bar', 'cvs']
> > >>> l.remove('cvs')
> > >>> l
> > ['foo', 'bar', 'cvs']
> 
> it will -- when the walk callback is called, the "names"
> argument only contains the files and subdirectories
> directly under "dirname"...
> 
> (if os.listdir returns duplicates on your computer,
> you should fix your operating system)

Oh yes, of course... stupid me :-)

regards,
Gerrit

-- 
Please correct any bad English you encounter in my email message!
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE?
Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK-----




More information about the Python-list mailing list