Set Value Of Variable If Nothing Is Entered. Python. Windows(timed Input)
I have to ask the user for 2 inputs. The first one is an integer to be used here. workbook = xlsxwriter.Workbook(str(date.today() - timedelta(days=days)) + '-' + excel_name + '.xls
Solution 1:
This is the option that works on Windows.
pip3 install func-timeout
from func_timeout import FunctionTimedOut, func_timeout
try:
days = func_timeout(5, lambda: int(input('Enter the number of days :\n')))
print(days)
except FunctionTimedOut:
days = 1
print(days)
for i in range(len(excel_name)):
print(i, ".", excel_name[i])
try:
choice = func_timeout(5, lambda: int(input('Enter the Menu Choice number :\n')))
print(choice)
except FunctionTimedOut:
choice = 0
print(choice)
Post a Comment for "Set Value Of Variable If Nothing Is Entered. Python. Windows(timed Input)"