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

2011-03-17 Thread Jussi Piitulainen
Laurent Claessens writes: > > file_list = [] > > for root, _, filenames in os.walk(root_path): > > for filename in filenames: > > file_list.append(os.path.join(root, filename)) > > What does the notation "_" stands for ? Is it a sort of /dev/null ? >>> x, _, y = 1, "hukairs",

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

2011-03-17 Thread Tim Golden
On 17/03/2011 08:58, Laurent Claessens wrote: file_list = [] for root, _, filenames in os.walk(root_path): for filename in filenames: file_list.append(os.path.join(root, filename)) What does the notation "_" stands for ? Is it a sort of /dev/null ? I know that in the terminal it represents

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

2011-03-17 Thread Laurent Claessens
file_list = [] for root, _, filenames in os.walk(root_path): for filename in filenames: file_list.append(os.path.join(root, filename)) What does the notation "_" stands for ? Is it a sort of /dev/null ? I know that in the terminal it represents the last printed text. Laurent

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

2011-03-16 Thread Alexander Kapps
On 16.03.2011 22:00, dude 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. The underscore is no magic here. It's just a conventional variable name, saying "I m unused". One could also write: for root, UNUSE

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

2011-03-16 Thread Benjamin Kaplan
On Wed, Mar 16, 2011 at 5:00 PM, dude 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 t

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

2011-03-16 Thread dude
awesome, that worked. I'm not sure how the magic is working with your underscores there, but it's doing what I need. thanks. -- http://mail.python.org/mailman/listinfo/python-list

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

2011-03-16 Thread Alexander Kapps
On 16.03.2011 20:41, dude wrote: My goal is create a list of absolute paths for all files in a given directory (any number of levels deep). root dir1 file1 file2 dir2 file3 dir3 -dir4 --file4 file5 So the above woul

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

2011-03-16 Thread dude
My goal is create a list of absolute paths for all files in a given directory (any number of levels deep). root dir1 file1 file2 dir2 file3 dir3 -dir4 --file4 file5 So the above would return: [root/dir1/file1, root/di