Python Forum
datetime.date() - TypeError: an integer is required (got type str)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
datetime.date() - TypeError: an integer is required (got type str)
#6
well, you have line33 where you iterate over months as integers from range(1,13), but after that you have line37 where you use variable month to iterate over list months. all elements in list months are str, what you expect to happen? :-) Of course it will raise TypeError...
Actually you iterate 4*12 times over elements of years list and months list because of lines 32-33
Fix lines 32-37
Reply


Messages In This Thread
RE: datetime.date() - TypeError: an integer is required (got type str) - by buran - Jan-30-2018, 02:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question TypeError: argument of type 'NoneType' is not iterable Tajaldeen 7 2,634 Nov-29-2024, 09:45 AM
Last Post: Tajaldeen
  Compare current date on calendar with date format file name Fioravanti 1 2,090 Mar-26-2024, 08:23 AM
Last Post: Pedroski55
  Python date format changes to date & time 1418 4 2,765 Jan-20-2024, 04:45 AM
Last Post: 1418
  TypeError: a bytes-like object is required ZeroX 13 16,040 Jan-07-2023, 07:02 PM
Last Post: deanhystad
  Review my code: convert a HTTP date header to a datetime object stevendaprano 1 4,193 Dec-17-2022, 12:24 AM
Last Post: snippsat
  "SUMIF" type query in Python (help required) BlainEillimatta 0 1,515 Oct-06-2022, 09:08 AM
Last Post: BlainEillimatta
  TypeError: a bytes-like object is required, not 'str' - Help Please. IanJ 3 8,211 Aug-29-2022, 05:53 PM
Last Post: deanhystad
  TypeError: unsupported operand type(s) for +: 'dict' and 'int' nick12341234 1 11,432 Jul-15-2022, 04:04 AM
Last Post: ndc85430
  TypeError: unsupported opperand type(s) for %: 'int' and 'list' cool_person 7 3,666 May-07-2022, 08:40 AM
Last Post: ibreeden
  TypeError: missing a required argument: 'y' gible 0 3,866 Dec-15-2021, 02:21 AM
Last Post: gible

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020