我在Python中有一个星期几的枚举:
class days_of_the_week(str, Enum):
monday = 'monday'
tuesday = 'tuesday'
wednesday = 'wednesday'
thursday = 'thursday'
friday = 'friday'
saturday = 'saturday'
sunday = 'sunday'
我希望能够通过索引访问该值。
我尝试过:
days_of_the_week.value[index]
days_of_the_week[index].value
days_of_the_week.values()[index]
我尝试了所有方法,但都没有返回enum的值(例如:days_of_the_week[1] >>> 'tuesday')。
有什么方法可以实现吗?