Just use the python datetime module:
import datetime
dayOfWeek = datetime.datetime(y, m, d).weekday()
dayOfWeek
will then be an integer between 0 and 6 corresponding to Monday – Sunday.
Have a look at the docs for more details.
solved Can anyone translate this into python? [closed]