ignoring a part of returned tuples

noamtm noamtm at gmail.com
Wed Jul 4 10:08:56 CEST 2007


Hi,

Some functions, like os.walk(), return multiple items packed as a
tuple:

for (dirpath, dirnames, filenames) in os.walk(...):

Now, if you don't care about one of the tuple members, is there a
clean way to ignore it, in a way that no unused variable is being
created?

What I wanted is:
for (dirpath, , filenames) in os.walk(...):

But that doesn't work.

Thanks, Noam.




More information about the Python-list mailing list