date and time to just time in python -


i have made small program weather station in python , working perfectly, have 1 little problem.

the output displays

2014/5/18 04:03:41 2014/5/18 19:47:41 

i want display

04:03:41 19:47:41 

is there easy way this,i thinking of stripping characters out sounds more of bodge converting.

thanks help

in [66]: t="2014/5/18 19:47:41".split()  in [67]: print t[-1] 19:47:41 

if have string split , last element time.

t="2014/5/18 04:03:41" datetime import datetime str_time= datetime.strptime(t,'2014/5/18  %h:%m:%s').time() in [72]: print str_time 04:03:41 

datetime docs


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -