def parse_time(time):
    '''Change the time to seconds'''
    unit = time[-1]
    if unit not in ['s', 'm', 'h', 'd']:
        print_error('the unit of time could only from {s, m, h, d}')
        exit(1)
    time = time[:-1]
    if not time.isdigit():
        print_error('time format error!')
        exit(1)
    parse_dict = {'s':1, 'm':60, 'h':3600, 'd':86400}
    return int(time) * parse_dict[unit]
def parse_time ( time ) : unit = time [ - 1 ] if unit not in [ 's' , 'm' , 'h' , 'd' ] : print_error ( 'the unit of time could only from {s, m, h, d}' ) exit ( 1 ) time = time [ : - 1 ] if not time . isdigit ( ) : print_error ( 'time format error!' ) exit ( 1 ) parse_dict = { 's' : 1 , 'm' : 60 , 'h' : 3600 , 'd' : 86400 } return int ( time ) * parse_dict [ unit ]
Change the time to seconds