Re: [Tutor] help regarding string

2006-07-03 Thread Kent Johnson
anil maran wrote: > > 'datetime.datetime' object has no attribute 'split' > > > thisis the error i get Ah, then your data is not a string, it is a datetime.datetime object. You can format it using datetime.datetime.strftime(): In [1]: import datetime In [2]: d=datetime.datetime.now() In

Re: [Tutor] help regarding string

2006-07-02 Thread Kent Johnson
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

[Tutor] help regarding string

2006-07-02 Thread anil maran
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 thanks a lot __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.co