You can use the date.weekday()
method to get the weekday index (0 for Monday, 1 for Tuesday,..., 6 for Sunday). Then you can use a dictionary to map the index to the corresponding weekday name.
Here's an example code:
main.py471 chars23 lines
Alternatively, you can use the date.strftime()
method to format the date as a string with the weekday name. Here's an example:
main.py213 chars10 lines
Note that both methods assume that Monday is the first day of the week. If you want to use a different start day, you'll need to adjust the weekday index accordingly.
gistlibby LogSnag