On Thu, 11 Dec 2008 13:50:10 -0800 Danek Duvall <[email protected]> wrote:
> >> line 239: Ew. One: just use os.walk(). > > > > If I'm reading the manual pages correctly, I'd have to call > > os.path.walk(self.prefix, myfunc, None) > > then each time myfunc is called, I'd have to call os.listdir() > > to get a list of all the files in that directory, and for each one > > I'd then have to see if it's of type "f" (os.path.isfile()). You're reading the wrong manual page. That's os.path.walk, he said os.walk, which is a generator, and hence easier to use in scripts: lines = [] for dir, _, files in os.walk(self.prefix): lines.extend(os.path.join(dir, file) for file in files) <mike -- Mike Meyer <[email protected]> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org _______________________________________________ pkg-discuss mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
