[Tutor] MOdule accessing its own date/time stamp?

Karl Pflästerer sigurd at 12move.de
Sat Feb 21 16:29:41 EST 2004


On 21 Feb 2004, Terry Carroll <- carroll at tjc.com wrote:

> Is there any way for a module to access the timestamp for itself?

> I'd like a module to be able to print out the time/date on which it was 
> last saved.

********************************************************************
# module foo

from os.path import getmtime
from time import ctime

def last_saved ():
    return ctime(getmtime(__file__))
********************************************************************

$ python
Python 2.3.3 (#1, Dec 30 2003, 08:29:25) 
[GCC 3.3.1 (cygming special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import foo
>>> foo.last_saved()
'Sat Feb 21 22:27:38 2004'
>>> 


Or did you mean something else?



   Karl
-- 
Please do *not* send copies of replies to me.
I read the list




More information about the Tutor mailing list