Skip to content

Check if a day is weekday or weekend in Python

Advertisements

from datetime import datetime
d = datetime(2020, 12, 25);
if d.weekday() > 4:
    print 'Given date is weekend.'
else:
    print 'Given data is weekday.'

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.