I have a menu, where I input a start and end-date. I get an error when I select choice 2 in below menu-item.
### Take action as per selected menu-option ###
if choice == 1: # Start with default window
print ("Starting Backtest from 2014-1-1 until 2015-12-31")
start = datetime.datetime(2014,1,1)
start = start.date()
end = datetime.datetime(2015,12,31)
end = end.date()
elif choice == 2:
## Get input ###
start = input('Enter Start date [Format: YYYY,M,D - 2014,1,23] : ')
start = datetime.datetime(start)
start = start.date()
end = input('Enter End date [Format: 2015,8,23] : ')
end = datetime.datetime(end)
end = end.date()
How is it possible that my menu-item 1 works but 2 doesn't?
The error is
TypeError: an integer is required (got type str)
Please help
Thanks