Re: [Tutor] recursive using the os.walk(path) from the os module

2008-09-18 Thread Alan Gauld
"A. Joseph" <[EMAIL PROTECTED]> wrote I want to search through a directory and re-arrange all the files into e.g All .doc files go into MS WORD folder, all .pdf files goes into PDF Folder. I`m thinking of doing something with the os.walk(path) method from os Which aspect is puzzling you

[Tutor] Miles Per Gallon Calculator`

2008-09-18 Thread iannaconec
When = raw_input ( " please enter a number " ) = int  () is run as part of a python script It should take in the user stored input and store it as an integer. Am I correct. The string represented by in memory is now represented by 5 for example?If this is correct why do I get an error regardi

Re: [Tutor] recursive using the os.walk(path) from the os module

2008-09-18 Thread Richard Lovely
The way I'd do it is create a dict mapping extensions to folders (something like {'doc': 'word', 'pdf': 'acrobat'} ), then use os.renames(old, new), which works the same as moving when you give it a different path for new, and also magically handles creating new directories for you. The documentat

Re: [Tutor] Miles Per Gallon Calculator`

2008-09-18 Thread W W
On Thu, Sep 18, 2008 at 5:14 AM, <[EMAIL PROTECTED]> wrote: > When = raw_input ( " please enter a number " ) > = int () is run as part of a python script It should > take in the user stored input and store it as an integer. Am I correct. The > string represented by in memory is now represented

Re: [Tutor] Miles Per Gallon Calculator`

2008-09-18 Thread Kent Johnson
On Thu, Sep 18, 2008 at 6:14 AM, <[EMAIL PROTECTED]> wrote: > When = raw_input ( " please enter a number " ) > = int () is run as part of a python script It should > take in the user stored input and store it as an integer. Am I correct. The > string represented by in memory is now represented

Re: [Tutor] command history in a console

2008-09-18 Thread W W
On Wed, Sep 17, 2008 at 9:14 PM, Hans Dushanthakumar < [EMAIL PROTECTED]> wrote: > G'day everyone. > > I'm experimenting with a custom console application, and trying to add > command history functionality to it. It seems to basically work ok except > for the fact that when I press the Up arrow ke

Re: [Tutor] Miles Per Gallon Calculator`

2008-09-18 Thread bob gailer
[EMAIL PROTECTED] wrote: When = raw_input ( " please enter a number " ) = int () is run as part of a python script It should take in the user stored input and store it as an integer. Am I correct. The string represented by in memory is now represented by 5 for example? If this is correct w

[Tutor] PyCon 2009 (US) - Call for Tutorials

2008-09-18 Thread Greg Lindstrom
*Pycon 2009 (US) – Call for Tutorials* The period for submitting tutorial proposals for Pycon 2009 (US) is now open and will continue through Friday, October 31th. This year features two "pre-conference" days devoted to tutorials on Wednesday March 25 & Thursday March 26 in Chicago. This allows fo

[Tutor] not operator

2008-09-18 Thread jeremiah
i want to check if a dir does not exist. how do i change this statement to evaluate is NOT existing? ==False or ! operator. Also, is sys.exit appropriate to use to quit out of the program? if(os.access(target_dir, os.F_OK)): print "File does not exist!" sys.exit Disclai

Re: [Tutor] not operator

2008-09-18 Thread Alan Gauld
"jeremiah" <[EMAIL PROTECTED]> wrote i want to check if a dir does not exist. how do i change this statement to evaluate is NOT existing? ==False or ! operator. Also, is sys.exit appropriate to use to quit out of the program? if(os.access(target_dir, os.F_OK)): print "File does not exist!" s

Re: [Tutor] not operator

2008-09-18 Thread christopher . henk
[EMAIL PROTECTED] wrote on 09/18/2008 06:12:30 PM: > i want to check if a dir does not exist. how do i change this statement > to evaluate is NOT existing? ==False or ! operator. Also, is sys.exit > appropriate to use to quit out of the program? > > if(os.access(target_dir, os.F_OK)): >print

Re: [Tutor] not operator

2008-09-18 Thread Steve Willoughby
On Thu, Sep 18, 2008 at 07:19:29PM -0400, [EMAIL PROTECTED] wrote: > if not os.access(target_dir, os.F_OK): > if os.access(target_dir, os.F_OK)==False: > if os.access(target_dir, os.F_OK)!=True: IMHO it's generally bad form to use numeric == or != operators to compare values against True, False, a

[Tutor] deltatime difficulty

2008-09-18 Thread Wayne Watson
Title: Signature.html What's the problem here. It seems right to me. line 9 is diff =... import time from datetime import datetime def adjust_ftime(afilename, sec):     # Vmmdd_hhmmss+tag, seconds in, new mmdd_hhmmss out     ts = afilename[1:-7]  # use time stamp portion     format

Re: [Tutor] deltatime difficulty

2008-09-18 Thread greg whittier
On Thu, Sep 18, 2008 at 8:38 PM, Wayne Watson <[EMAIL PROTECTED]>wrote: > What's the problem here. It seems right to me. line 9 is diff =... > > import time > from datetime import datetime > > You've imported the datetime class from the datetime module. > > def adjust_ftime(afilename, sec): >

Re: [Tutor] deltatime difficulty

2008-09-18 Thread Don Jennings
On 9/18/08, Wayne Watson <[EMAIL PROTECTED]> wrote: > What's the problem here. It seems right to me. line 9 is diff =... >> >> import time >> from datetime import datetime >> def adjust_ftime(afilename, sec): >> # Vmmdd_hhmmss+tag, seconds in, new mmdd_hhmmss out >> ts = afilename[1

Re: [Tutor] deltatime difficulty

2008-09-18 Thread Wayne Watson
Title: Signature.html Well, that works. Thanks. How do I know what modules (?) or methods are in datetime? greg whittier wrote: On Thu, Sep 18, 2008 at 8:38 PM, Wayne Watson <[EMAIL PROTECTED]> wrote: What's the problem here. It seems right to me. line 9 is diff =... import ti

Re: [Tutor] deltatime difficulty

2008-09-18 Thread Kent Johnson
On Thu, Sep 18, 2008 at 9:01 PM, Wayne Watson <[EMAIL PROTECTED]> wrote: > Well, that works. Thanks. How do I know what modules (?) or methods are in > datetime? >From the docs: http://docs.python.org/lib/node78.html or ask: In [4]: import datetime In [5]: dir(datetime) Out[5]: ['MAXYEAR', 'MIN

Re: [Tutor] deltatime difficulty

2008-09-18 Thread Wayne Watson
Title: Signature.html Thanks for the tips to all. Ah, yes, Help. I'll check out the link at the bottom. After I'm done arm wrestling my current program into being, I'll go back to the documentation for a review. I'm in the clean up stages now of checking and validating user input. Otherwise