Breaking out of walk()
Gerrit Holl
gerrit.holl at pobox.com
Sun Jan 16 13:59:19 EST 2000
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']
use:
>>> while 'cvs' in l:
... l.remove('cvs')
...
>>> l
['foo', 'bar']
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