start = "00:00"
end = "23:59"
times = []
start = now = datetime.datetime.strptime(start, "%H:%M")
end = datetime.datetime.strptime(end, "%H:%M")
while now != end:
times.append(str(now.strftime("%H:%M")))
now += datetime.timedelta(minutes=1)
times.append(end.strftime("%H:%M"))
st.multiselect('Departure hour:',times)
times = []
for hours in range(0, 23):
for minutes in range(0, 59):
times.append(datetime.time(hours, minutes))
st.selectbox("Time", times, key="time", format_func=lambda t: t.strftime("%H:%M"))
2条答案
按热度按时间eblbsuwk1#
2uluyalo2#
改进答案: