RE: [Tutor] walking directories

2005-01-08 Thread Nick Lunt
>>From: Ryan Davis [mailto:[EMAIL PROTECTED] ?? >>I think you want to be doing something like: >> >>>for r,d,f in os.walk('.'): >>... for filename in f: >>... print os.path.join(r,filename) >> >>I think that would give you the full path of every file, and then you can open it, do a rege

Re: [Tutor] walking directories

2005-01-08 Thread Alan Gauld
> > Shouldn't that be os.path.walk()? > > It says in the documentation (it might be the newer ones?): > > "Note: The newer os.walk() generator supplies similar functionality and can > be easier to use." > -- 6.2 os.path -- Common pathname manipulations Ah, I assume that must be a 2.3 additio

Re: [Tutor] walking directories

2005-01-07 Thread Jacob S.
> Shouldn't that be os.path.walk()? It says in the documentation (it might be the newer ones?): "Note: The newer os.walk() generator supplies similar functionality and can be easier to use." -- 6.2 os.path -- Common pathname manipulations And, yet, the os.walk() function states (condensed):

Re: [Tutor] walking directories

2005-01-07 Thread Alan Gauld
> I have many python scripts in various directories of > varying depth under my home directory, and I need to > change one line in each of these files. personally I'd use find and sed in Linux, right tool for the job etc... But if you really must wheel out a howitzer to shoot a squirrel... >

RE: [Tutor] walking directories

2005-01-07 Thread Ryan Davis
I think you want to be doing something like: >>>for r,d,f in os.walk('.'): ... for filename in f: ... print os.path.join(r,filename) I think that would give you the full path of every file, and then you can open it, do a regex substitution or whatever close it and keep going. Th