Re: [Tutor] Program to report if file was modified today

2009-02-12 Thread David
David wrote: > Kent Johnson wrote: > >> On Wed, Feb 11, 2009 at 11:21 PM, bob gailer wrote: >> >> >> > Thanks Alan and Kent, > This works as expected; > > #!/usr/bin/python > import sys > import os > import time > > def mod(): > """Find files modified today, given a file path.""" >

Re: [Tutor] Program to report if file was modified today

2009-02-12 Thread David
Kent Johnson wrote: > On Wed, Feb 11, 2009 at 11:21 PM, bob gailer wrote: > > Thanks Alan and Kent, This works as expected; #!/usr/bin/python import sys import os import time def mod(): """Find files modified today, given a file path.""" now = time.strftime('%Y-%m-%d', time.localtime(

Re: [Tutor] Program to report if file was modified today

2009-02-12 Thread Kent Johnson
On Wed, Feb 11, 2009 at 11:21 PM, bob gailer wrote: > David wrote: >> >> I get this error with the int(time.localtime()) >> start_of_today = int(time.localtime()) >> TypeError: int() argument must be a string or a number, not >> 'time.struct_time' > > Should have been start_of_today = int(time.ti

Re: [Tutor] Program to report if file was modified today

2009-02-12 Thread Alan Gauld
"David" wrote I really only want it to report when a file has been modified so this seems to work, #!/usr/bin/python import sys import os import time def mod(): """Find files modified today, given a file path.""" latest = 0 now = time.strftime('%Y-%m-%d', time.localtime())

Re: [Tutor] Program to report if file was modified today

2009-02-11 Thread bob gailer
David wrote: I get this error with the int(time.localtime()) start_of_today = int(time.localtime()) TypeError: int() argument must be a string or a number, not 'time.struct_time' Should have been start_of_today = int(time.time()) -- Bob Gailer Chapel Hill NC 919-636-4239

Re: [Tutor] Program to report if file was modified today

2009-02-11 Thread David
bob gailer wrote: 1) That can't be the entire program, as there is no call to Mod()! Yep, it was lost in my copy paste 2) Convention says function names start with lower case. Save initial caps for class names. Thanks for the reminder, I had forgotten :) 3) Get rid of latest - that is why yo

Re: [Tutor] Program to report if file was modified today

2009-02-11 Thread Kent Johnson
On Wed, Feb 11, 2009 at 8:46 PM, bob gailer wrote: > 5) It is not necessary to convert times to strings. You can get midnight > today from int(time.localtime()) ?? In [1]: import time In [2]: time.localtime() Out[2]: time.struct_time(tm_year=2009, tm_mon=2, tm_mday=11, tm_hour=21, tm_min=20, tm

Re: [Tutor] Program to report if file was modified today

2009-02-11 Thread bob gailer
David wrote: Hi Everyone and thanks for the list and your help. In my adventure in learning Python (never programed before) I am attempting to findout if a file has been modified today given a search path. It is working somewhat. Here it is; #!/usr/bin/python import sys import os import time

[Tutor] Program to report if file was modified today

2009-02-11 Thread David
Hi Everyone and thanks for the list and your help. In my adventure in learning Python (never programed before) I am attempting to findout if a file has been modified today given a search path. It is working somewhat. Here it is; #!/usr/bin/python import sys import os import time def Mod():