Re: A little assistance with os.walk please.

2006-08-14 Thread Tim Chase
> >>> allowed = ['.txt', '.sql'] > >>> for path, dirs, files in os.walk("."): > ... for f in files: > ... if splitext(f)[1].lower() not in allowed: continue Additionally, if you really do want to specify wildcards: >>> allowed = ['*.txt', 'README*', '*.xml', '*.htm*'] >>> from

Re: A little assistance with os.walk please.

2006-08-14 Thread KraftDiner
Tim Chase wrote: > > 1) there seems to be an optional topdown flag. Is that passed to > > os.walk(path, topdownFlag) > > Yes. > > > 2) I only want to process files that match *.txt for example... Does > > that mean I need to parse the list of files for the .txt extention or > > can I pass a wild

Re: A little assistance with os.walk please.

2006-08-14 Thread Tim Chase
> 1) there seems to be an optional topdown flag. Is that passed to > os.walk(path, topdownFlag) Yes. > 2) I only want to process files that match *.txt for example... Does > that mean I need to parse the list of files for the .txt extention or > can I pass a wildcard in the path parameter? >>

Re: A little assistance with os.walk please.

2006-08-14 Thread KraftDiner
Larry Bates wrote: > KraftDiner wrote: > > The os.walk function walks the operating systems directory tree. > > > > This seems to work, but I don't quite understand the tupple that is > > returned... > > Can someone explain please? > > > > for root, dirs, files in os.walk('/directory/'): > > p

Re: A little assistance with os.walk please.

2006-08-14 Thread Larry Bates
KraftDiner wrote: > The os.walk function walks the operating systems directory tree. > > This seems to work, but I don't quite understand the tupple that is > returned... > Can someone explain please? > > for root, dirs, files in os.walk('/directory/'): > print root > # print dirs > #

Re: A little assistance with os.walk please.

2006-08-14 Thread Tim Chase
> The os.walk function walks the operating systems directory tree. Yup. > This seems to work, but I don't quite understand the tupple that is > returned... > Can someone explain please? > > for root, dirs, files in os.walk('/directory/'): > print root > # print dirs > # print files

Re: A little assistance with os.walk please.

2006-08-14 Thread Pontus Ekberg
On Mon, 14 Aug 2006 07:44:39 -0700, KraftDiner wrote: > The os.walk function walks the operating systems directory tree. > > This seems to work, but I don't quite understand the tupple that is > returned... > Can someone explain please? > > for root, dirs, files in os.walk('/directory/'): >

A little assistance with os.walk please.

2006-08-14 Thread KraftDiner
The os.walk function walks the operating systems directory tree. This seems to work, but I don't quite understand the tupple that is returned... Can someone explain please? for root, dirs, files in os.walk('/directory/'): print root # print dirs # print files -- http://mail.