[Tutor] Error while using calendar module in Python 2.7

Steven D'Aprano steve at pearwood.info
Sat Mar 5 10:47:55 CET 2011


ranjan das wrote:
> I ran the following code in python 2.6 and then in python 2.7 (using
> calendar module) to manipulate dates and times
> 
> The following code works fine in Python 2.6 but throws up an error in Python
> 2.7. Can anyone please say why?

No it does not work fine at all. It generates a SyntaxError in every 
version of Python, including 2.6 and 2.7:

     print next week
                   ^
SyntaxError: invalid syntax


After fixing that error, I get:

NameError: name 'monday' is not defined


Please COPY and PASTE the ACTUAL code you run, do not retype it. Make 
sure that it actually does run before claiming it runs. Do not waste 
everybody's time with junk code that doesn't run, and them waste our 
time again with not one but *two* corrections, neither of which actually 
fix the broken code.




-- 
Steven



More information about the Tutor mailing list