{"id":505,"date":"2011-11-30T16:15:48","date_gmt":"2011-11-30T08:15:48","guid":{"rendered":"http:\/\/www.hsyyf.me\/?p=505"},"modified":"2012-04-24T20:15:38","modified_gmt":"2012-04-24T12:15:38","slug":"python3-2%e7%89%88%e4%b8%87%e5%b9%b4%e5%8e%86","status":"publish","type":"post","link":"https:\/\/www.hsyyf.me\/?p=505","title":{"rendered":"Python3.2\u7248\u4e07\u5e74\u5386"},"content":{"rendered":"<p>\u7b97\u6cd5\u548cC\u7684\u4e00\u6837\uff0c\u53ea\u662f\u7531\u4e8ePython3.2\u8fd8\u662f\u63a8\u5e7f\u4e0d\u8db3\uff0cprint\u51fd\u6570\u683c\u5f0f\u4e0d\u751a\u4e86\u89e3\uff0c\u8d39\u4e86\u597d\u957f\u65f6\u95f4\u624d\u641c\u5230\u3002<br \/>\n<code lang=\"python\">#!\/usr\/bin\/env python3<br \/>\ndef run(m):<br \/>\n    if m%100==0:<br \/>\n        if m%400==0:<br \/>\n            return 29<br \/>\n        else:<br \/>\n            return 28<br \/>\n    else:<br \/>\n        if year%4==0:<br \/>\n            return 29<br \/>\n        else:<br \/>\n            return 28<\/p>\n<p>print(\"\u4e07\u5e74\u5386Python\u7248\")<br \/>\nyear=int(input(\"\u8bf7\u8f93\u5165\u5e74\u4efd\uff1a\"))<br \/>\nmonth=int(input(\"\u8bf7\u8f93\u5165\u6708\u4efd\uff1a\"))<\/p>\n<p>c=int(year\/100)<br \/>\ny=year-c*100<br \/>\nif month&lt;=2:<br \/>\n    month+=12<br \/>\n    y-=1<br \/>\nw=int(c\/4)-2*c+int(y\/4)+y+int(13*(month+1)\/5)<br \/>\nwhile w&lt;0:<br \/>\n    w+=7<br \/>\ni=w%7<\/p>\n<p>if month==1 or month==3 or month==5 or month==7 or month==8 or month==10 or month==12:<br \/>\n    day=31<br \/>\nelse:<br \/>\n    if month==4 or month==6 or month==9 or month==11:<br \/>\n        day=30<br \/>\n    else:<br \/>\n        day=run(year)<\/p>\n<p>print(\"  S  M  T  W  T  F  S\")<br \/>\nn=1<br \/>\nfor j in [1,2,3,4,5]:<br \/>\n    for k in [1,2,3,4,5,6,7]:<br \/>\n        if j==1 and ((j-1)*5+k-1)&lt;i:<br \/>\n            print('   ',end='')<br \/>\n        else:<br \/>\n            if n&lt;=day:<br \/>\n                print(\"%3d\" % n,end='')<br \/>\n                n+=1<br \/>\n    print()<br \/>\ninput(\"Press &lt;Enter&gt; to end\")<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b97\u6cd5\u548cC\u7684\u4e00\u6837\uff0c\u53ea\u662f\u7531\u4e8ePython3.2\u8fd8\u662f\u63a8\u5e7f\u4e0d\u8db3\uff0cprint\u51fd\u6570\u683c\u5f0f\u4e0d\u751a\u4e86\u89e3\uff0c\u8d39\u4e86\u597d\u957f\u65f6\u95f4\u624d\u641c\u5230\u3002 #! [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[16],"tags":[87,89],"class_list":["post-505","post","type-post","status-publish","format-standard","hentry","category-16","tag-python","tag-89"],"_links":{"self":[{"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/posts\/505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=505"}],"version-history":[{"count":0,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/posts\/505\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}