-3

I found an answer to getting the last day of months: https://stackoverflow.com/a/13565185/11661097

This answer is in python 2 and in python 3 when I run this code I get this error:

print(self.last_day_of_month(start))
TypeError: last_day_of_month() takes 1 positional argument but 2 were given

start is a datetime object (datetime.date(someyear, somemonth, someday) so it should be exactly the same as the answer given in the question.

Is this because the answer is in python 2? If so, how would I rewrite it so it works in python 3?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
drewster
  • 83
  • 1
  • 8

1 Answers1

1

For last_day_of_month()

  • Use self as the first parameter, and
  • Use start as the second parameter,

So, do last_day_of_month(self, start)

Waqar Bin Kalim
  • 321
  • 1
  • 7