>>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
> > 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
> 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):
> 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...
>
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