Thanks for your help. I knew of a way to solve this issue, but being a C++ programmer I tend to think of the expanded solutions for things. I wasn't sure if there was a more compact solution for python. Thanks again!
On Mon, Feb 25, 2008 at 11:27 AM, Tim Chase <[EMAIL PROTECTED]> wrote: > >> ignored_dirs = ( > >> r".\boost\include", # It's that comma that makes this a tuple. > >> ) > >> > > > > Thanks for reminding me of this. I always forget that! > > > > Now that it is correctly doing *only* whole string matches, what if I > want > > to make it do a substring compare to each string in my ignored_dirs > tuple? > > Sounds like a good opportunity for the underused for/break/else > construct: > > ###################################################### > ignored_dirs = ( > r".\boost\include", > ) > > if __name__ == "__main__": > # Walk the directory tree rooted at 'source' > for root, dirs, files in os.walk( source ): > for dirname in ignored_dirs: > # may need to normalize to root.lower() > if dirname in root: > print 'Skipping', root > break > else: > CopyFiles( root, files, ".dll" ) > ###################################################### > > -tkc > > >
-- http://mail.python.org/mailman/listinfo/python-list