卖逼视频免费看片|狼人就干网中文字慕|成人av影院导航|人妻少妇精品无码专区二区妖婧|亚洲丝袜视频玖玖|一区二区免费中文|日本高清无码一区|国产91无码小说|国产黄片子视频91sese日韩|免费高清无码成人网站入口

python輸入年月日輸出星期幾 Python:輸入年月日判斷是此年的第多少天?

Python:輸入年月日判斷是此年的第多少天?[import datetimey=int(input(“please input 4-digital year:”)“get yearm=int(inp

Python:輸入年月日判斷是此年的第多少天?

[import datetime

y=int(input(“please input 4-digital year:”)“get year

m=int(input(“please input month:”)“get month

d=int(input(“please input which day:”)“get day

targetday=datetime.date日期(年,月,d) #將輸入的日期格式化為標準日期

daycount=targetday-datetime.date日期( targetDay.year公司-1,12,31)#減去上一年的最后一天

打?。?s是%s年的第%s天?!?(targetDay,ydayCount.days天))

今年是2011年。如果輸入2011并按enter鍵,日期將直接顯示。如果您輸入2011,將顯示完整日期。另外,用ALT-shift d直接輸入日期,用ALT-shift輸入當前時間

1。Python正則表達式的輸入日期規(guī)范如下:

year,month,day=Eval(input(“please input year,month,day,separated by comma”)

months=[31,28,31,30,31

]if(year%4==0 and year  0!=0)或(年@0==0):

months[1]=29#在閏年,二月最多有29天

如果month<1或month>12:

print(“非法月”

elif day<1或day>months[month 1

]print(“非法日”

否則:

print(“合法月/日”

2。代碼:

3。結果: