Victor Subervi wrote:
Hi;
I have the following code:

import calendar, datetime

def cal():
  ...
  myCal = calendar.Calendar(calendar.SUNDAY)
  today = datetime.date.today()
  day = today.day
  mo = today.month
  yr = today.year
#  month = myCal.monthdayscalendar(int(time.strftime("%Y"))
  month = myCal.monthdayscalendar(yr, mo)
  print 'hi'

html headers are included. No matter which one of the last two lines I comment out, I never get to the point of printing 'hi'. (If I comment them both out, it does print.) What do?

Read the tracebacks?

The commented line will raise an exception because:

1. There's a final ')' missing.

2. You haven't imported 'time'.

3. .monthdayscalendar() requires the year and month.

I don't know why you're writing 'int(time.strftime("%Y"))' because you
already have the year in 'yr'.

The code above works for me if I comment out the line '...'.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to