Reputation: 209
I am outputting timestamps (eg. 2012-02-24 13:18:45.552882) and I'd like to remove the last part (here would be .552882) from the output file, so I would only have date and time to the second. How can I do this?
Thanks in advance!
Upvotes: 1
Views: 1002
Reputation: 1021
>>> date = '2012-02-24 13:18:45.552882'
>>> good, bad = date.split('.')
>>> good
'2012-02-24 13:18:45'
>>> bad
'552882'
Upvotes: 1