MichaB Klich wrote:
Dnia wtorek 03 listopada 2009 o 20:50:10 Victor Subervi napisał(a):
Hi;
I have the following:
import calendar, datetime
myCal =alendar.calendar(6)
today =atetime.date.today()
day =oday.day
mo =oday.month
yr =oday.year
month =yCal.monthdayscalendar(yr, mo)
The last line throws errors no matter how I try and tweak it. The current
incarnation complains about myCal being a string. What do?
TIA,
Victor
You should use
myCal =calendar.Calendar(6)
This creates calendar.Calendar object.
Right. But I wanted to tell the OP what to do with an error like this.
You should post the actual error traceback, and tell us what version of
Python you're using:
Traceback (most recent call last):
File "M:\Programming\Python\sources\dummy\stuff2.py", line 15, in <module>
month = myCal.monthdayscalendar(yr, mo)
AttributeError: 'str' object has no attribute 'monthdayscalendar'
Now, since it says that myCal is a 'str' object, the next thing you
should do is look at the value. I get an actual printable calendar for a
year. So clearly, it's not the Calendar object you were looking for. So
you need to change from the calendar() function to the Calendar()
constructor.
DaveA
--
http://mail.python.org/mailman/listinfo/python-list