{"id":982206,"date":"2024-12-27T07:08:57","date_gmt":"2024-12-26T23:08:57","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/982206.html"},"modified":"2024-12-27T07:08:59","modified_gmt":"2024-12-26T23:08:59","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e8%ae%a1%e7%ae%97%e6%97%b6%e9%97%b4","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/982206.html","title":{"rendered":"\u5982\u4f55\u7528python\u8ba1\u7b97\u65f6\u95f4"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24210804\/b863587a-d31d-4850-a364-6f4cd3801027.webp\" alt=\"\u5982\u4f55\u7528python\u8ba1\u7b97\u65f6\u95f4\" \/><\/p>\n<p><p> <strong>\u4f7f\u7528Python\u8ba1\u7b97\u65f6\u95f4\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff0c\u5305\u62ec\u4f7f\u7528<code>datetime<\/code>\u6a21\u5757\u3001<code>time<\/code>\u6a21\u5757\u548c<code>pytz<\/code>\u5e93\u7b49\u3002<code>datetime<\/code>\u6a21\u5757\u63d0\u4f9b\u4e86\u65e5\u671f\u548c\u65f6\u95f4\u8fd0\u7b97\u7684\u57fa\u672c\u529f\u80fd\u3001<code>time<\/code>\u6a21\u5757\u5219\u4e3b\u8981\u7528\u4e8e\u4e0e\u7cfb\u7edf\u65f6\u95f4\u4ea4\u4e92\u3001<code>pytz<\/code>\u5e93\u7528\u4e8e\u5904\u7406\u65f6\u533a\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528<code>datetime<\/code>\u6a21\u5757\u6765\u8fdb\u884c\u65f6\u95f4\u8ba1\u7b97\u7684\u4e00\u4e2a\u8be6\u7ec6\u8bf4\u660e\uff1a<\/strong> \u4f7f\u7528<code>datetime<\/code>\u6a21\u5757\u53ef\u4ee5\u8f7b\u677e\u5730\u83b7\u53d6\u5f53\u524d\u65f6\u95f4\u3001\u683c\u5f0f\u5316\u65f6\u95f4\u3001\u8fdb\u884c\u65f6\u95f4\u52a0\u51cf\u7b49\u64cd\u4f5c\u3002\u901a\u8fc7\u521b\u5efa<code>datetime<\/code>\u5bf9\u8c61\uff0c\u53ef\u4ee5\u8868\u793a\u7279\u5b9a\u7684\u65f6\u95f4\u70b9\uff0c\u7136\u540e\u901a\u8fc7\u8fd0\u7b97\u7b26\u8fdb\u884c\u65f6\u95f4\u5dee\u7684\u8ba1\u7b97\uff0c\u6216\u8005\u901a\u8fc7\u683c\u5f0f\u5316\u65b9\u6cd5\u5c06\u5176\u8f6c\u6362\u4e3a\u7279\u5b9a\u683c\u5f0f\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528DATETIME\u6a21\u5757<\/p>\n<\/p>\n<p><p><code>datetime<\/code>\u6a21\u5757\u662fPython\u6807\u51c6\u5e93\u4e2d\u5904\u7406\u65e5\u671f\u548c\u65f6\u95f4\u7684\u6838\u5fc3\u6a21\u5757\u3002\u5b83\u63d0\u4f9b\u4e86\u8bb8\u591a\u65b9\u4fbf\u7684\u7c7b\u548c\u65b9\u6cd5\u6765\u64cd\u4f5c\u65e5\u671f\u548c\u65f6\u95f4\u3002<\/p>\n<\/p>\n<p><h3>\u83b7\u53d6\u5f53\u524d\u65e5\u671f\u548c\u65f6\u95f4<\/h3>\n<\/p>\n<p><p>\u8981\u83b7\u53d6\u5f53\u524d\u7684\u65e5\u671f\u548c\u65f6\u95f4\uff0c\u53ef\u4ee5\u4f7f\u7528<code>datetime<\/code>\u6a21\u5757\u4e2d\u7684<code>datetime<\/code>\u7c7b\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from datetime import datetime<\/p>\n<p>now = datetime.now()<\/p>\n<p>print(&quot;\u5f53\u524d\u65e5\u671f\u548c\u65f6\u95f4\uff1a&quot;, now)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>datetime.now()<\/code>\u65b9\u6cd5\u8fd4\u56de\u5f53\u524d\u7684\u672c\u5730\u65e5\u671f\u548c\u65f6\u95f4\u3002\u8fd9\u662f\u4e00\u4e2a<code>datetime<\/code>\u5bf9\u8c61\uff0c\u5305\u542b\u5e74\u3001\u6708\u3001\u65e5\u3001\u65f6\u3001\u5206\u3001\u79d2\u548c\u5fae\u79d2\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h3>\u683c\u5f0f\u5316\u65e5\u671f\u548c\u65f6\u95f4<\/h3>\n<\/p>\n<p><p><code>datetime<\/code>\u5bf9\u8c61\u53ef\u4ee5\u901a\u8fc7<code>strftime()<\/code>\u65b9\u6cd5\u683c\u5f0f\u5316\u4e3a\u5b57\u7b26\u4e32\u3002\u8fd9\u4e2a\u65b9\u6cd5\u4f7f\u7528\u683c\u5f0f\u5316\u4ee3\u7801\u6765\u5b9a\u4e49\u8f93\u51fa\u683c\u5f0f\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">formatted_date = now.strftime(&quot;%Y-%m-%d %H:%M:%S&quot;)<\/p>\n<p>print(&quot;\u683c\u5f0f\u5316\u540e\u7684\u65e5\u671f\u548c\u65f6\u95f4\uff1a&quot;, formatted_date)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u5f53\u524d\u65f6\u95f4\u683c\u5f0f\u5316\u4e3a<code>YYYY-MM-DD HH:MM:SS<\/code>\u7684\u5f62\u5f0f\u3002\u5e38\u7528\u7684\u683c\u5f0f\u5316\u4ee3\u7801\u5305\u62ec\uff1a<\/p>\n<\/p>\n<ul>\n<li><code>%Y<\/code>\uff1a\u56db\u4f4d\u6570\u7684\u5e74\u4efd<\/li>\n<li><code>%m<\/code>\uff1a\u4e24\u4f4d\u6570\u7684\u6708\u4efd\uff0801 \u5230 12\uff09<\/li>\n<li><code>%d<\/code>\uff1a\u4e24\u4f4d\u6570\u7684\u65e5\u671f\uff0801 \u5230 31\uff09<\/li>\n<li><code>%H<\/code>\uff1a\u4e24\u4f4d\u6570\u7684\u5c0f\u65f6\uff0800 \u5230 23\uff09<\/li>\n<li><code>%M<\/code>\uff1a\u4e24\u4f4d\u6570\u7684\u5206\u949f\uff0800 \u5230 59\uff09<\/li>\n<li><code>%S<\/code>\uff1a\u4e24\u4f4d\u6570\u7684\u79d2\uff0800 \u5230 59\uff09<\/li>\n<\/ul>\n<p><h3>\u8ba1\u7b97\u65f6\u95f4\u5dee<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528<code>datetime<\/code>\u6a21\u5757\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u8ba1\u7b97\u4e24\u4e2a\u65f6\u95f4\u70b9\u4e4b\u95f4\u7684\u65f6\u95f4\u5dee\u3002\u8fd9\u53ef\u4ee5\u901a\u8fc7\u521b\u5efa\u4e24\u4e2a<code>datetime<\/code>\u5bf9\u8c61\u5e76\u76f8\u51cf\u6765\u5b9e\u73b0\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from datetime import timedelta<\/p>\n<p>future_date = now + timedelta(days=5)<\/p>\n<p>difference = future_date - now<\/p>\n<p>print(&quot;\u4e24\u4e2a\u65f6\u95f4\u70b9\u4e4b\u95f4\u7684\u5dee\uff1a&quot;, difference)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u672a\u6765\u7684\u65e5\u671f<code>future_date<\/code>\uff0c\u5b83\u6bd4\u5f53\u524d\u65e5\u671f\u665a5\u5929\u3002\u7136\u540e\uff0c\u901a\u8fc7\u76f8\u51cf\uff0c\u5f97\u5230\u4e24\u4e2a\u65f6\u95f4\u70b9\u4e4b\u95f4\u7684\u5dee\u3002<\/p>\n<\/p>\n<p><h3>\u65f6\u95f4\u52a0\u51cf<\/h3>\n<\/p>\n<p><p><code>timedelta<\/code>\u7c7b\u7528\u4e8e\u8868\u793a\u65f6\u95f4\u7684\u6301\u7eed\u65f6\u95f4\uff0c\u53ef\u4ee5\u7528\u4e8e\u52a0\u51cf<code>datetime<\/code>\u5bf9\u8c61\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u901a\u8fc7<code>timedelta<\/code>\u8fdb\u884c\u65f6\u95f4\u52a0\u51cf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">one_week_later = now + timedelta(weeks=1)<\/p>\n<p>print(&quot;\u4e00\u5468\u540e\u7684\u65e5\u671f\u548c\u65f6\u95f4\uff1a&quot;, one_week_later)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>timedelta<\/code>\u7c7b\u521b\u5efa\u4e00\u4e2a\u8868\u793a\u4e00\u5468\u65f6\u95f4\u7684\u5bf9\u8c61\uff0c\u7136\u540e\u5c06\u5176\u52a0\u5230\u5f53\u524d\u65f6\u95f4\u4e0a\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u4f7f\u7528TIME\u6a21\u5757<\/p>\n<\/p>\n<p><p><code>time<\/code>\u6a21\u5757\u63d0\u4f9b\u4e86\u4e00\u4e9b\u4f4e\u7ea7\u7684\u65f6\u95f4\u51fd\u6570\uff0c\u4e3b\u8981\u7528\u4e8e\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u65f6\u95f4\u4ea4\u4e92\u3002<\/p>\n<\/p>\n<p><h3>\u83b7\u53d6\u65f6\u95f4\u6233<\/h3>\n<\/p>\n<p><p><code>time<\/code>\u6a21\u5757\u4e2d\u7684<code>time()<\/code>\u51fd\u6570\u8fd4\u56de\u5f53\u524d\u65f6\u95f4\u7684\u65f6\u95f4\u6233\u3002\u65f6\u95f4\u6233\u8868\u793a\u81ea1970\u5e741\u67081\u65e5\u4ee5\u6765\u7684\u79d2\u6570\uff08\u901a\u5e38\u79f0\u4e3aUnix\u65f6\u95f4\u6216\u7eaa\u5143\u65f6\u95f4\uff09\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import time<\/p>\n<p>timestamp = time.time()<\/p>\n<p>print(&quot;\u5f53\u524d\u65f6\u95f4\u6233\uff1a&quot;, timestamp)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u6682\u505c\u7a0b\u5e8f\u6267\u884c<\/h3>\n<\/p>\n<p><p><code>time<\/code>\u6a21\u5757\u4e2d\u7684<code>sleep()<\/code>\u51fd\u6570\u53ef\u4ee5\u7528\u4e8e\u6682\u505c\u7a0b\u5e8f\u7684\u6267\u884c\uff0c\u5355\u4f4d\u662f\u79d2\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;\u7a0b\u5e8f\u6682\u505c3\u79d2...&quot;)<\/p>\n<p>time.sleep(3)<\/p>\n<p>print(&quot;\u7a0b\u5e8f\u7ee7\u7eed\u6267\u884c&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e09\u3001\u4f7f\u7528PYTZ\u5e93\u5904\u7406\u65f6\u533a<\/p>\n<\/p>\n<p><p><code>pytz<\/code>\u662f\u4e00\u4e2a\u7b2c\u4e09\u65b9\u5e93\uff0c\u7528\u4e8e\u5904\u7406\u65f6\u533a\u95ee\u9898\u3002Python\u7684<code>datetime<\/code>\u6a21\u5757\u672c\u8eab\u4e0d\u652f\u6301\u65f6\u533a\u8f6c\u6362\uff0c\u800c<code>pytz<\/code>\u53ef\u4ee5\u5f88\u597d\u5730\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h3>\u5b89\u88c5PYTZ\u5e93<\/h3>\n<\/p>\n<p><p>\u5728\u4f7f\u7528<code>pytz<\/code>\u4e4b\u524d\uff0c\u9700\u8981\u5148\u5b89\u88c5\u5b83\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install pytz<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u65f6\u533a\u8f6c\u6362<\/h3>\n<\/p>\n<p><p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528<code>pytz<\/code>\u5e93\u8fdb\u884c\u65f6\u533a\u8f6c\u6362\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from datetime import datetime<\/p>\n<p>import pytz<\/p>\n<p>utc_now = datetime.now(pytz.utc)<\/p>\n<p>print(&quot;UTC\u65f6\u95f4\uff1a&quot;, utc_now)<\/p>\n<h2><strong>\u8f6c\u6362\u4e3a\u7f8e\u56fd\u4e1c\u90e8\u65f6\u95f4<\/strong><\/h2>\n<p>eastern = pytz.timezone(&#39;US\/Eastern&#39;)<\/p>\n<p>eastern_time = utc_now.astimezone(eastern)<\/p>\n<p>print(&quot;\u7f8e\u56fd\u4e1c\u90e8\u65f6\u95f4\uff1a&quot;, eastern_time)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u83b7\u53d6\u5f53\u524d\u7684UTC\u65f6\u95f4\uff0c\u7136\u540e\u4f7f\u7528<code>astimezone()<\/code>\u65b9\u6cd5\u5c06\u5176\u8f6c\u6362\u4e3a\u7f8e\u56fd\u4e1c\u90e8\u65f6\u95f4\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u7efc\u5408\u5e94\u7528\u5b9e\u4f8b<\/p>\n<\/p>\n<p><p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7efc\u5408\u5e94\u7528\u5b9e\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528<code>datetime<\/code>\u548c<code>pytz<\/code>\u5e93\u8fdb\u884c\u590d\u6742\u7684\u65f6\u95f4\u8ba1\u7b97\u548c\u683c\u5f0f\u5316\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from datetime import datetime, timedelta<\/p>\n<p>import pytz<\/p>\n<h2><strong>\u83b7\u53d6\u5f53\u524d\u7684UTC\u65f6\u95f4<\/strong><\/h2>\n<p>utc_now = datetime.now(pytz.utc)<\/p>\n<p>print(&quot;\u5f53\u524dUTC\u65f6\u95f4\uff1a&quot;, utc_now.strftime(&quot;%Y-%m-%d %H:%M:%S %Z%z&quot;))<\/p>\n<h2><strong>\u8f6c\u6362\u4e3a\u5176\u4ed6\u65f6\u533a<\/strong><\/h2>\n<p>timezones = [&#39;US\/Eastern&#39;, &#39;Europe\/London&#39;, &#39;Asia\/Shangh<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>&#39;]<\/p>\n<p>for tz in timezones:<\/p>\n<p>    local_time = utc_now.astimezone(pytz.timezone(tz))<\/p>\n<p>    print(f&quot;{tz}\u65f6\u95f4\uff1a&quot;, local_time.strftime(&quot;%Y-%m-%d %H:%M:%S %Z%z&quot;))<\/p>\n<h2><strong>\u8ba1\u7b97\u7279\u5b9a\u65e5\u671f\u4e0e\u5f53\u524d\u65e5\u671f\u7684\u5dee\u8ddd<\/strong><\/h2>\n<p>specific_date = datetime(2023, 12, 31, tzinfo=pytz.utc)<\/p>\n<p>difference = specific_date - utc_now<\/p>\n<p>print(f&quot;\u8ddd\u79bb{specific_date.strftime(&#39;%Y-%m-%d&#39;)}\u8fd8\u6709\uff1a&quot;, difference.days, &quot;\u5929&quot;)<\/p>\n<h2><strong>\u589e\u52a0\u4e00\u4e2a\u6708<\/strong><\/h2>\n<p>one_month_later = utc_now + timedelta(days=30)<\/p>\n<p>print(&quot;\u4e00\u4e2a\u6708\u540e\u7684UTC\u65f6\u95f4\uff1a&quot;, one_month_later.strftime(&quot;%Y-%m-%d %H:%M:%S %Z%z&quot;))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u83b7\u53d6\u5f53\u524dUTC\u65f6\u95f4\uff0c\u8f6c\u6362\u4e3a\u591a\u4e2a\u65f6\u533a\uff0c\u8ba1\u7b97\u7279\u5b9a\u65e5\u671f\u4e0e\u5f53\u524d\u65e5\u671f\u7684\u5dee\u8ddd\uff0c\u5e76\u589e\u52a0\u4e00\u4e2a\u6708\u7684\u65f6\u95f4\u3002\u901a\u8fc7\u8fd9\u4e9b\u4f8b\u5b50\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230Python\u5728\u5904\u7406\u65e5\u671f\u548c\u65f6\u95f4\u65b9\u9762\u7684\u5f3a\u5927\u529f\u80fd\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u83b7\u53d6\u5f53\u524d\u65f6\u95f4\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>datetime<\/code>\u6a21\u5757\u83b7\u53d6\u5f53\u524d\u65f6\u95f4\u3002\u901a\u8fc7<code>datetime.datetime.now()<\/code>\u51fd\u6570\u53ef\u4ee5\u65b9\u4fbf\u5730\u83b7\u53d6\u7cfb\u7edf\u7684\u5f53\u524d\u65e5\u671f\u548c\u65f6\u95f4\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">import datetime\ncurrent_time = datetime.datetime.now()\nprint(&quot;\u5f53\u524d\u65f6\u95f4:&quot;, current_time)\n<\/code><\/pre>\n<p><strong>Python\u4e2d\u5982\u4f55\u8fdb\u884c\u65f6\u95f4\u52a0\u51cf\u8fd0\u7b97\uff1f<\/strong><br \/>\u65f6\u95f4\u52a0\u51cf\u8fd0\u7b97\u53ef\u4ee5\u901a\u8fc7<code>timedelta<\/code>\u5bf9\u8c61\u5b9e\u73b0\u3002<code>timedelta<\/code>\u5141\u8bb8\u5bf9\u65e5\u671f\u548c\u65f6\u95f4\u8fdb\u884c\u52a0\u51cf\u64cd\u4f5c\uff0c\u65b9\u4fbf\u8fdb\u884c\u65f6\u95f4\u8ba1\u7b97\u3002\u4f8b\u5982\uff0c\u589e\u52a05\u5929\u7684\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">from datetime import datetime, timedelta\ncurrent_time = datetime.now()\nnew_time = current_time + timedelta(days=5)\nprint(&quot;5\u5929\u540e\u7684\u65f6\u95f4:&quot;, new_time)\n<\/code><\/pre>\n<p><strong>\u5982\u4f55\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u65f6\u95f4\u683c\u5f0f\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>strptime<\/code>\u65b9\u6cd5\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a<code>datetime<\/code>\u5bf9\u8c61\u3002\u9700\u8981\u6307\u5b9a\u5b57\u7b26\u4e32\u7684\u683c\u5f0f\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">from datetime import datetime\ndate_string = &quot;2023-10-15 14:30:00&quot;\ndate_object = datetime.strptime(date_string, &#39;%Y-%m-%d %H:%M:%S&#39;)\nprint(&quot;\u8f6c\u6362\u540e\u7684\u65f6\u95f4\u5bf9\u8c61:&quot;, date_object)\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u975e\u5e38\u9002\u5408\u5904\u7406\u65e5\u671f\u548c\u65f6\u95f4\u7684\u5b57\u7b26\u4e32\u683c\u5f0f\uff0c\u65b9\u4fbf\u8fdb\u884c\u540e\u7eed\u7684\u65f6\u95f4\u8ba1\u7b97\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4f7f\u7528Python\u8ba1\u7b97\u65f6\u95f4\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff0c\u5305\u62ec\u4f7f\u7528datetime\u6a21\u5757\u3001time\u6a21\u5757\u548cpytz\u5e93\u7b49\u3002dat [&hellip;]","protected":false},"author":3,"featured_media":982217,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/982206"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=982206"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/982206\/revisions"}],"predecessor-version":[{"id":982220,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/982206\/revisions\/982220"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/982217"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=982206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=982206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=982206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}