FW: [Tutor] walking directories

2005-01-09 Thread Nick Lunt
Hello, I sent this reply a few days ago, but it doesn't seem to have appeared on the list, so Im resending it. Many thanks Nick . -Original Message- From: Nick Lunt [mailto:[EMAIL PROTECTED] Sent: 08 January 2005 19:44 To: 'python tutor' Subject: RE: [Tutor] walk

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
e it and keep going. Thanks, Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nick Lunt Sent: Friday, January 07, 2005 5:32 PM To: python tutor Subject: [Tutor] walking directories Hi folks, Im running python2.4 on linux. I have many python scripts in

[Tutor] walking directories

2005-01-07 Thread Nick Lunt
Hi folks, Im running python2.4 on linux. 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. I thought about using os.walk with os.path.join eg >>> for r,d,f in os.walk('.'): ... print os.path.joi