Re: [Eug-lug] Python help - more elegant way to do this...

2006-03-28 Thread horst
Date: Mon, 27 Mar 2006 22:14:16 -0800 From: Martin Kelly <[EMAIL PROTECTED]> ...> Anyway, do you have anything in mind for how to use isfil, isdir, etc. in this program? Interesting! --I haven't used os.walk() for a while, and just looking at it(as in late at night): it seems like os.walk()

Re: [Eug-lug] Python help - more elegant way to do this...

2006-03-28 Thread horst
{merged stuff} Date: Mon, 27 Mar 2006 23:45:14 -0800 From: Bob Miller <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: [Python] Re: [Eug-lug] Python help - more elegant way to do this... ...> I've given up on this guideline. I use those words for local variables when th

Re: [Eug-lug] Python help - more elegant way to do this...

2006-03-27 Thread Martin Kelly
Thank you for the comments; this is the way I will improve. Definetely not too cricical. Yes, I know about those functions and must remeber them for later use... I often find myself hand-coding things too much rather than using the greatness that is python :). I recently made a program that ha

Re: [Eug-lug] Python help - more elegant way to do this...

2006-03-27 Thread horst
Date: Mon, 27 Mar 2006 10:28:30 -0800 From: Martin Kelly <[EMAIL PROTECTED]> ...> I will join the python group... I didn't know it existed :). GOOD! As others already commented on strategy I'm just adding some peripheral remarks. a) You can make the 'sha-bang' line more general: #!/usr/

Re: [Eug-lug] Python help - more elegant way to do this...

2006-03-27 Thread Martin Kelly
Not needed anymore, since I put in an os.chdir(topdir). It seems to be working now. Bob Miller wrote: Martin Kelly wrote: Thanks for the help. I have attached a changed version that I believe is better. I don't think it will work anymore. You took out the two calls to os.path.join() but th

Re: [Eug-lug] Python help - more elegant way to do this...

2006-03-27 Thread Bob Miller
Martin Kelly wrote: > Thanks for the help. I have attached a changed version that I believe is > better. I don't think it will work anymore. You took out the two calls to os.path.join() but they were needed. -- Bob Miller K

Re: [Eug-lug] Python help - more elegant way to do this...

2006-03-27 Thread Quentin Hartman
On 3/27/06, Martin Kelly <[EMAIL PROTECTED]> wrote: Lol, that was a result of my search and replace... not a name I made up.I meant that to say directory rather than topectory.Well thats good to hear! :D-- -Regards--Quentin Hartman- ___ EUGLUG mailing lis

Re: [Eug-lug] Python help - more elegant way to do this...

2006-03-27 Thread Martin Kelly
Thanks for the help. I have attached a changed version that I believe is better. I will join the python group... I didn't know it existed :). Bob Miller wrote: Martin Kelly wrote: I got it working, but it's rather messy, and I was wondering if there's a more elegant way to do it; after all,

Re: [Eug-lug] Python help - more elegant way to do this...

2006-03-27 Thread Martin Kelly
Lol, that was a result of my search and replace... not a name I made up. I meant that to say directory rather than topectory. Quentin Hartman wrote: On 3/27/06, *Martin Kelly* <[EMAIL PROTECTED] > wrote: Hi, I was creating a python script to rename all files i

Re: [Eug-lug] Python help - more elegant way to do this...

2006-03-27 Thread Bob Miller
Martin Kelly wrote: > I got it working, but it's rather messy, and I was wondering if there's > a more elegant way to do it; after all, it is python :). That's basically the right approach. Three comments. First, change this... newfile = file.replace(word , r_word) os.rename(os

Re: [Eug-lug] Python help - more elegant way to do this...

2006-03-27 Thread Quentin Hartman
On 3/27/06, Martin Kelly <[EMAIL PROTECTED]> wrote: Hi, I was creating a python script to rename all files in a directory asspecified by a given pattern. I know there are already programs that cando this, but I am doing this as a learning exercise.The format for the command is like this: rename /ho

[Eug-lug] Python help - more elegant way to do this...

2006-03-27 Thread Martin Kelly
Hi, I was creating a python script to rename all files in a directory as specified by a given pattern. I know there are already programs that can do this, but I am doing this as a learning exercise. The format for the command is like this: rename /home foo bar ... to change everything in /home