os.path.walk() to get full path of all files

Benjamin Kaplan benjamin.kaplan at case.edu
Wed Mar 16 17:13:22 EDT 2011


On Wed, Mar 16, 2011 at 5:00 PM, dude <erniedude at gmail.com> wrote:
> awesome, that worked.  I'm not sure how the magic is working with your underscores there, but it's doing what I need.  thanks.
> --

It's not magic at all. _ is just a variable name. When someone names a
variable _, it's just to let you know that they won't actually be
using that variable. In this case, os.walk returns three things: the
root, the list of directories, and the list of files. You only need
two of those for your code, so you ignore the third.



More information about the Python-list mailing list