anil maran wrote: > please help me format this string from > input : 2006-06-16 16:23:27.703000 to > output: 2006-06-16 16:23:27 > > or 2006-06-16 4:23:27 PM
str.split() can extract everything up to the first period: In [4]: '2006-06-16 16:23:27.703000'.split('.')[0] Out[4]: '2006-06-16 16:23:27' Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor