Python接收来自元组的两个整数参数

2024-04-26 14:06:48 发布

您现在位置:Python中文网/ 问答频道 /正文

这只是问题的一部分。运行时缺少1个必需的位置参数“mm”时出错。 我知道问题是它的运行时间是几分钟到几分钟((h,mm),) 我该怎么做才能让它像时间到分钟(h,mm)一样运行?你知道吗

def time_to_minutes(h,mm):
    time = h*60 + mm
    return time

def extract_time(time):
    h=int(time[:-3])
    mm=int(time[-2:])
    return h,mm

def time_between(a,b):
    first = time_to_minutes(extract_time(a))
    return first

Tags: to参数returntimedef时间extractbetween