-2

I want to have the function like the following

unit = "days"
datetime.datetime.now() + datetime.timedelta(unit = 1)

Where in the unit could be days, hours, and minutes etc., which may be changed according to the the time shift unit.

Is there any way to do it in a fast way?

0

1 Answer 1

2

You can give keyword arguments using a dictionary as follows:

args = {'days':1}
datetime.timedelta(**args)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.