python - how to pass argument to datetime.timedelta -


we know that, datetime.timedelta(hours= 5) proper syntax. how possible pass argument can replace 'hours' given in function down below?

    def check_time(until_when, def_time, how_long):             if until_when- datetime.datetime.now() > datetime.timedelta(def_time = how_long):             input('task has been finished.\npress key quit\n')             exit()   

def check_time(until_when, def_time, how_long):     arg_dict = {def_time:how_long}     dt = datetime.timedelta(**arg_dict)     if until_when- datetime.datetime.now() > dt:         input('task has been finished.\npress key quit\n')         exit() 

see understanding kwargs in python , the tutorial.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -