Get Day name from Weekday int

后端 未结 8 1118
梦如初夏
梦如初夏 2020-12-14 05:14

I have a weekday integer (0,1,2...) and I need to get the day name (\'Monday\', \'Tuesday\',...).

Is there a built in Python function or way of doing this?

H

8条回答
  •  执笔经年
    2020-12-14 06:12

    You can use index number like this:

    days=["sunday","monday"," Tuesday", "Wednesday" ,"Thursday", "Friday", "Saturday"]
    def date(i):
    
        return days[i]
    print (date(int(input("input index.  "))))
    

提交回复
热议问题