Ed Singleton wrote: > I seem to have a lot of questions today. Sorry. > > How can I convert a string in the format "%Y-%m-%d %H:%M:%S" into a > datetime object? > > I can work out how to convert it to a time object by: > > import time > timestring = "2005-09-01 12:30:09" > time_format = "%Y-%m-%d %H:%M:%S" > mytime = time.strptime(timestring,time_format) > > I can't seem to work out how to convert the time object into a > datetime object...
Try datetime.datetime(*mytime[:6]) Gee, two questions in one day where the answer is, "Use extended function call syntax" ;) Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor