def _load_request_list(self): global requests requests = DB.GetRequest(userData[0]) requestList = [] for i in range(0, len(requests)): date = datetime.strptime(requests[i][2], '%d-%m-%Y') d = timedelta(days = int(requests[i][3] - 1)) requestList.append("%10s - %10s" % (date.strftime('%d-%m-%Y'), (date + d).strftime('%d-%m-%Y'))) return requestList
def AskRecoverVersion(user): print("Укажите интервал прогноза") versions = DBAccess.GetRequest(user) for i in range(0, len(versions)): date = datetime.strptime(versions[i][2], '%d-%m-%Y') d = timedelta(days=int(versions[i][3])) print("%i) %10s - %10s" % (i + 1, date.strftime('%d-%m-%Y'), (date + d).strftime('%d-%m-%Y'))) while 1: try: answer = int(input()) except: print("Неверный индекс") continue if answer - 1 < len(versions): return versions[answer - 1] else: print("Неверный индекс")