Quote:
Originally Posted by mevets
I have an array of all the days off the week. I also have a var with the name of the current day written like "Tuesday". How do I search the array of days for my current day and get an integer returned speaking to where the instance is.
Code:
now = datetime.datetime.now()
curDay = now.strftime("%A")
weekDays = ("Monday", "Tuesday", "Wednesday", "Thurday", "Friday", "Saturday", "Sunday")
intDay = # this where I would search for curDay in weekDays
cmbDay.set_active(intDay) # set the combo to the current day
|
I had to change
Code:
weekDays = ("Monday", "Tuesday", "Wednesday", "Thurday", "Friday", "Saturday", "Sunday")
to
Code:
weekDays = ["Monday", "Tuesday", "Wednesday", "Thurday", "Friday", "Saturday", "Sunday"]
and to find where the day was in the array of days I
Code:
weekDays.index(curDay)
So hard to find on google