[Tutor] Error while using calendar module in Python 2.7

David Hutto smokefloat at gmail.com
Sat Mar 5 08:28:20 CET 2011


Could you paste the whle code, because I get:

>>> import datetime
>>> import calendar
>>>
>>>
>>>
>>> while monday.weekday() != calendar.MONDAY:
...
  File "<stdin>", line 2

    ^
IndentationError: expected an indented block
>>>     monday -= oneday
  File "<stdin>", line 1
    monday -= oneday
    ^
IndentationError: unexpected indent
>>>
>>> oneweek = datetime.timedelta(days=7)
>>>
>>> nextweek = today + oneweek
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'today' is not defined
>>>
>>> print next week


More information about the Tutor mailing list