Created
December 21, 2011 06:27
-
-
Save mharju/1504903 to your computer and use it in GitHub Desktop.
8h 12m 23s to hours representation. Used as python -c '<script here>'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import sys | |
i = sys.stdin.readline() | |
print "%.2f" % sum( [ x*y for x, y in zip([int(a) for a in re.match(r'(\d+)h (\d+)m (\d+)s', i).groups()], (1, 1/60., 1/(60.*60.))) ]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment