17 lines
362 B
Python
17 lines
362 B
Python
import re
|
|
|
|
|
|
def decode_format(value):
|
|
match = re.match(r'(\d+):(\d)', value)
|
|
if match:
|
|
minute = int(match.group(1))
|
|
second = int(match.group(2))
|
|
time = minute * 60 + second
|
|
return time
|
|
else:
|
|
return None
|
|
|
|
|
|
if __name__ == '__main__':
|
|
value = input("输入转换的时间戳:")
|
|
print(decode_format(value)) |