>>> >>> while monday.weekday() != calendar.MONDAY: ... monday -= oneday ... oneweek = datetime.timedelta(days=7) ... nextweek = today + oneweek ... print "next week" ... Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'monday' is not defined >>>
This means that calender doesn't have an Monday as something you can access. Look at how you use datetime.timedelta(days=7). If you type help (datetime), you can see that timedelta is a function you can access from datetime. However your utilization of calendar doesn't align with the other. Look at the difference in each using the help function(datetime.timedelta and calendar.MONDAY). Also the error you show is a little confusing, because it looks like you were trying calendar.FRIDAY instead of calendar.MONDAY at that point. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor