{"id":169594,"date":"2020-10-12T14:09:53","date_gmt":"2020-10-12T06:09:53","guid":{"rendered":"http:\/\/4563.org\/?p=169594"},"modified":"2020-10-12T14:09:53","modified_gmt":"2020-10-12T06:09:53","slug":"python-%e6%a0%bc%e5%bc%8f%e5%8c%96%e6%97%b6%e9%97%b4%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=169594","title":{"rendered":"Python \u683c\u5f0f\u5316\u65f6\u95f4\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Python \u683c\u5f0f\u5316\u65f6\u95f4\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xunbug <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u8fd9\u79cd\u5e26\u65f6\u533a\u7684\u65f6\u95f4\uff1a2020-10-20T21:26:06.913277863+09:00\uff0c\u5982\u4f55\u683c\u5f0f\u5316\uff1a%Y:%m:%d %H:%M:%S<\/p>\n<p>\u4e0d\u53ef\u5f71\u54cd\u65f6\u95f4\u7cbe\u5ea6<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3823424\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : xunbug <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u70b9\u90c1\u95f7\uff0c\u4e0d\u77e5\u5982\u4f55\u4e0b\u624b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3823425\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : no1xsyzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             datetime \u9ed8\u8ba4\u4e0d\u5e26 tzinfo\uff0c\u9700\u8981\u63d2\u5165<br \/>\u6216\u8005\u4f60\u81ea\u5df1\u968f\u4fbf\u5199\u5199\u65f6\u533a\u4e5f\u884c<\/p>\n<p>&gt;&gt;&gt; datetime(2006,1,2,15,4,5,7,tzinfo=timezone(timedelta(hours=8))).strftime(&#8220;%Y:%m:%dT%H:%M:%S.%f%z&#8221;)<br \/>&#8216;2006:01:02T15:04:05.000007+0800&#8217;<\/p>\n<p>\u4e0d\u8fc7 datetime \u7684\u7cbe\u5ea6\u53ea\u5230 \u03bcs\uff0c\u5bfb\u6c42\u7b2c\u4e09\u65b9\u5e93\u6216\u8005\u5e72\u8106\u8865\u4e09\u4e2a 0 \u5427                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3823426\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : misaka19000 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3b\u751f\u6d3b\u5728\u65e5\u672c\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3823427\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Tromso <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e4b\u524d\u7528 python \u5904\u7406 MongoDB \u91cc\u7684\u65f6\u95f4, dateutil \u5e93\u53ef\u4ee5\u8f6c\u6362<br \/>from dateutil import parser<br \/>parser.parse(&#8220;2020-10-20T21:26:06.913277863+09:00&#8221;).strftime(&#8220;%Y:%m:%d %H:%M:%S&#8221;)                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3823428\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : noobsheldon <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u65f6\u95f4\u5904\u7406\u63a8\u8350 arrow \u5e93                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3823429\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : xunbug <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @no1xsyzy \u5df2\u7ecf\u89e3\u51b3\uff0c\u4e0d\u80fd\u591f\u5199\u6b7b\u65f6\u533a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3823430\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : no1xsyzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @xunbug \u54e6\u770b\u4f60\u7b54\u6848\u539f\u6765\u6211\u5b8c\u5168\u8bfb\u9519\u9898\u76ee\u4e86\uff0c\u522b\u4ecb\uff08                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3823431\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : kailyn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             &gt;&gt;&gt; import arrow<br \/>&gt;&gt;&gt; a = &#8220;2020-10-20T21:26:06.913277863+09:00&#8221;<br \/>&gt;&gt;&gt; b = arrow.get(a)<br \/>&gt;&gt;&gt; b<br \/>&lt;Arrow [2020-10-20T21:26:06.913278+09:00]&gt;<br \/>&gt;&gt;&gt; b.format(&#8220;YYYY-MM-DD hh:mm:ss&#8221;)<br \/>&#8216;2020-10-20 09:26:06&#8217;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Python \u683c\u5f0f\u5316\u65f6\u95f4\u95ee\u9898 \u8cc7\u6df1&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/169594"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=169594"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/169594\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=169594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=169594"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=169594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}