ina wrote: > I want to walk a folder structor and group all the files by extention. > > Here is the code I put together is there a better way of doing this? > <code> [snip]
If you were to download Jason Orendorff's "path" module, which is a convenient single-file package that vastly simplifies all manner of dealings with directory and file names, I suspect your example code could be reduced to less than half the number of lines it now uses, and with a corresponding increase in readability and maintainability. The answer to the question "is there a better way of doing this?" in relation to paths is always "yes, use Jason Orendorff's path module". -Peter -- http://mail.python.org/mailman/listinfo/python-list