Yep, I tried strptime and strftime but got stuck too often on something
or other (mostly mixing time, datetime somehow), so simplified matters
to make it clear what I was trying to do. I'm sure you have the essence below, but I'm not familiar with the In/ Out notation. Apparently, I need to scoop up the In lines into a file and add some print stmts for the In[x] d lines. Here's what I think I should put in a py file and the results: # Using datetime to do date-time math on a file date-time stamp andResults: Traceback (most recent call last):This attribute problem is reminiscent of my problems. IDLE? Python 2.4.x? Kent Johnson wrote: On Sun, Sep 7, 2008 at 9:33 PM, Wayne Watson <[EMAIL PROTECTED]> wrote:Here's as far as I can go with this. The last line of output asks the question I need an answer for. (Once again my direct post to tutor@python.org has failed to appear here (sent 5:42 PDT), as before.)It arrived late for some reason.You can do what you want much more simply using datetime.strptime() and strftime(): In [2]: from datetime import datetime, timedelta In [3]: format = '%Y%m%d_%H%M%S' In [8]: d=datetime.strptime('20080321_113405', format) In [10]: d Out[10]: datetime.datetime(2008, 3, 21, 11, 34, 5) In [13]: d += timedelta(seconds=200) In [14]: d Out[14]: datetime.datetime(2008, 3, 21, 11, 37, 25) In [15]: d.strftime(format) Out[15]: '20080321_113725' Kent --
Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "If voting made any difference they wouldn't let us do it." -- Mark Twain Web Page: <www.speckledwithstars.net/> |
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor