time string conversion

jepler at unpythonic.net jepler at unpythonic.net
Tue Jul 19 19:01:27 EDT 2005


def smadi(s):
	h, m, s = s.split(":")
	h = int(h)
	m = int(m)
	s = float(s)
	return s + m*60 + h * 3600

>>> print smadi("16:23:20.019519")
59000.019519

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050719/dd9ad6cc/attachment.sig>


More information about the Python-list mailing list