Created
September 21, 2018 03:12
-
-
Save RRRoger/3898985b6ec0d14d236feb73ca8a5a90 to your computer and use it in GitHub Desktop.
min2millisec
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
def min2millisec(t): | |
""" | |
将`03:36`转化成毫秒 | |
:param t: min string like '00:43' | |
:return: millisec int | |
""" | |
if not t: | |
return t | |
tim = t.split(":")[::-1] | |
depth = 0 | |
rel = 60 | |
res = 0 | |
for s in tim: | |
res += float(s) * (rel ** depth) | |
depth += 1 | |
return res * 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1:20:30.123
格式也支持哦;