Faced with a ValueError: month out of range error. Please tell me the reason and how to correct the error. Briefly about the meaning of the script: enter the month, day, year, we get the output data object in a specific format. Then I will finish writing the script to display only the day of the week, without the data entered.
%%writefile day_finder.py import time, datetime import argparse parser = argparse.ArgumentParser() parser.add_argument("month", type = int, help = "Month as a number (1, 12)") parser.add_argument("day", type = int, help = "Day as a number (1, 31) depending on the month") parser.add_argument("year", type = int, help = "Year as a 4 digits number (2018)") parser.add_argument("-c", "--complete", action = 'store_true', help = "Show complete formatted date") args = parser.parse_args() d = () d = (args.month, args.day, args.year, 0, 0 , 0 , 0, 0, 0) date_v = time.strftime("%m,%d,%Y", d) print (date_v) Running the script:
%%bash python3 day_finder.py 12 31 2017
d = (args.year, args.month, args.day, 0, 0 , 0 , 0, 0, 0)? - MaxU 2:01 pmdatetime.date(args.year, args.month, args.day).strftime("%m,%d,%Y")- MaxU