{"id":1144304,"date":"2025-01-08T22:58:28","date_gmt":"2025-01-08T14:58:28","guid":{"rendered":""},"modified":"2025-01-08T22:58:32","modified_gmt":"2025-01-08T14:58:32","slug":"python%e5%a6%82%e4%bd%95%e8%ae%a1%e7%ae%97%e4%b8%80%e4%b8%aa%e4%ba%ba%e5%a4%9a%e5%b0%91%e5%b2%81","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1144304.html","title":{"rendered":"python\u5982\u4f55\u8ba1\u7b97\u4e00\u4e2a\u4eba\u591a\u5c11\u5c81"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24181454\/d2103749-6027-4b29-b3ac-c5a9d10bcd57.webp\" alt=\"python\u5982\u4f55\u8ba1\u7b97\u4e00\u4e2a\u4eba\u591a\u5c11\u5c81\" \/><\/p>\n<p><p> <strong>Python\u8ba1\u7b97\u4e00\u4e2a\u4eba\u5e74\u9f84\u7684\u65b9\u6cd5\u6709\u51e0\u79cd<\/strong>\uff0c<strong>\u53ef\u4ee5\u4f7f\u7528datetime\u6a21\u5757\u3001time\u6a21\u5757\u3001dateutil\u5e93<\/strong>\u7b49\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u5e76\u63d0\u4f9b\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u9645\u5e94\u7528\u573a\u666f\u3002<strong>\u4f7f\u7528datetime\u6a21\u5757\u662f\u6700\u5e38\u89c1\u548c\u63a8\u8350\u7684\u65b9\u6cd5<\/strong>\uff0c\u56e0\u4e3a\u5b83\u63d0\u4f9b\u4e86\u5f3a\u5927\u4e14\u7075\u6d3b\u7684\u65e5\u671f\u5904\u7406\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528datetime\u6a21\u5757\u8ba1\u7b97\u5e74\u9f84<\/strong><\/p>\n<\/p>\n<p><p>datetime\u6a21\u5757\u662fPython\u6807\u51c6\u5e93\u7684\u4e00\u90e8\u5206\uff0c\u65e0\u9700\u989d\u5916\u5b89\u88c5\u3002\u8be5\u6a21\u5757\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u65e5\u671f\u548c\u65f6\u95f4\u5904\u7406\u529f\u80fd\uff0c\u5305\u62ec\u8ba1\u7b97\u5e74\u9f84\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from datetime import datetime<\/p>\n<p>def calculate_age(birthdate):<\/p>\n<p>    today = datetime.today()<\/p>\n<p>    age = today.year - birthdate.year - ((today.month, today.day) &lt; (birthdate.month, birthdate.day))<\/p>\n<p>    return age<\/p>\n<h2><strong>\u793a\u4f8b\u7528\u6cd5<\/strong><\/h2>\n<p>birthdate = datetime(1990, 5, 24)<\/p>\n<p>print(f&#39;\u5e74\u9f84\u662f: {calculate_age(birthdate)}&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u9996\u5148\u83b7\u53d6\u5f53\u524d\u65e5\u671f\uff0c\u7136\u540e\u8ba1\u7b97\u5f53\u524d\u5e74\u4efd\u4e0e\u51fa\u751f\u5e74\u4efd\u4e4b\u95f4\u7684\u5dee\u503c\u3002\u5982\u679c\u4eca\u5929\u7684\u65e5\u671f\u8fd8\u672a\u5230\u51fa\u751f\u65e5\u671f\u7684\u5f53\u6708\u548c\u65e5\uff0c\u5219\u5e74\u9f84\u51cf\u4e00\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528datetime\u6a21\u5757<\/h3>\n<\/p>\n<p><h4>1\u3001\u57fa\u7840\u7528\u6cd5<\/h4>\n<\/p>\n<p><p>datetime\u6a21\u5757\u7684\u57fa\u7840\u7528\u6cd5\u975e\u5e38\u7b80\u5355\uff0c\u4e3b\u8981\u662f\u5229\u7528datetime\u7c7b\u548ctimedelta\u7c7b\u6765\u8fdb\u884c\u65e5\u671f\u8ba1\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from datetime import datetime, timedelta<\/p>\n<h2><strong>\u83b7\u53d6\u5f53\u524d\u65e5\u671f\u548c\u65f6\u95f4<\/strong><\/h2>\n<p>now = datetime.now()<\/p>\n<p>print(f&#39;\u5f53\u524d\u65e5\u671f\u548c\u65f6\u95f4: {now}&#39;)<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u7279\u5b9a\u7684\u65e5\u671f\u5bf9\u8c61<\/strong><\/h2>\n<p>birthdate = datetime(1990, 5, 24)<\/p>\n<p>print(f&#39;\u51fa\u751f\u65e5\u671f: {birthdate}&#39;)<\/p>\n<h2><strong>\u8ba1\u7b97\u5e74\u9f84<\/strong><\/h2>\n<p>def calculate_age(birthdate):<\/p>\n<p>    today = datetime.today()<\/p>\n<p>    age = today.year - birthdate.year - ((today.month, today.day) &lt; (birthdate.month, birthdate.day))<\/p>\n<p>    return age<\/p>\n<p>age = calculate_age(birthdate)<\/p>\n<p>print(f&#39;\u5e74\u9f84\u662f: {age}&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u8003\u8651\u95f0\u5e74\u548c\u7279\u6b8a\u65e5\u671f<\/h4>\n<\/p>\n<p><p>\u6709\u65f6\u5019\uff0c\u8ba1\u7b97\u5e74\u9f84\u9700\u8981\u8003\u8651\u5230\u95f0\u5e74\u548c\u7279\u6b8a\u65e5\u671f\u3002datetime\u6a21\u5757\u5df2\u7ecf\u4e3a\u6211\u4eec\u5904\u7406\u4e86\u8fd9\u4e9b\u590d\u6742\u6027\uff0c\u56e0\u6b64\u6211\u4eec\u4e0d\u9700\u8981\u989d\u5916\u7684\u4ee3\u7801\u6765\u5904\u7406\u8fd9\u4e9b\u60c5\u51b5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from datetime import datetime<\/p>\n<p>def calculate_age(birthdate):<\/p>\n<p>    today = datetime.today()<\/p>\n<p>    age = today.year - birthdate.year - ((today.month, today.day) &lt; (birthdate.month, birthdate.day))<\/p>\n<p>    return age<\/p>\n<h2><strong>\u793a\u4f8b\u7528\u6cd5<\/strong><\/h2>\n<p>birthdate = datetime(2000, 2, 29)  # \u95f0\u5e74\u51fa\u751f\u65e5\u671f<\/p>\n<p>print(f&#39;\u5e74\u9f84\u662f: {calculate_age(birthdate)}&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u8ba1\u7b97\u95f0\u5e74\u51fa\u751f\u7684\u4eba\u7684\u5e74\u9f84\u3002datetime\u6a21\u5757\u81ea\u52a8\u5904\u7406\u4e86\u8fd9\u4e00\u590d\u6742\u6027\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528time\u6a21\u5757<\/h3>\n<\/p>\n<p><h4>1\u3001\u57fa\u7840\u7528\u6cd5<\/h4>\n<\/p>\n<p><p>time\u6a21\u5757\u4e5f\u662fPython\u6807\u51c6\u5e93\u7684\u4e00\u90e8\u5206\uff0c\u4f46\u5b83\u4e3b\u8981\u7528\u4e8e\u5904\u7406\u65f6\u95f4\u76f8\u5173\u7684\u4efb\u52a1\uff0c\u5982\u7761\u7720\u3001\u8ba1\u65f6\u7b49\u3002\u5c3d\u7ba1\u5982\u6b64\uff0c\u5b83\u4e5f\u53ef\u4ee5\u7528\u4e8e\u8ba1\u7b97\u5e74\u9f84\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import time<\/p>\n<p>def calculate_age(birthdate):<\/p>\n<p>    today = time.localtime()<\/p>\n<p>    age = today.tm_year - birthdate.tm_year - ((today.tm_mon, today.tm_mday) &lt; (birthdate.tm_mon, birthdate.tm_mday))<\/p>\n<p>    return age<\/p>\n<h2><strong>\u793a\u4f8b\u7528\u6cd5<\/strong><\/h2>\n<p>birthdate = time.strptime(&quot;1990-05-24&quot;, &quot;%Y-%m-%d&quot;)<\/p>\n<p>print(f&#39;\u5e74\u9f84\u662f: {calculate_age(birthdate)}&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u5904\u7406\u4e0d\u540c\u7684\u65f6\u95f4\u683c\u5f0f<\/h4>\n<\/p>\n<p><p>time\u6a21\u5757\u63d0\u4f9b\u4e86strptime\u51fd\u6570\uff0c\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u65f6\u95f4\u5bf9\u8c61\u3002\u8fd9\u4f7f\u5f97\u5904\u7406\u4e0d\u540c\u7684\u65f6\u95f4\u683c\u5f0f\u53d8\u5f97\u66f4\u52a0\u5bb9\u6613\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import time<\/p>\n<p>def calculate_age(birthdate):<\/p>\n<p>    today = time.localtime()<\/p>\n<p>    age = today.tm_year - birthdate.tm_year - ((today.tm_mon, today.tm_mday) &lt; (birthdate.tm_mon, birthdate.tm_mday))<\/p>\n<p>    return age<\/p>\n<h2><strong>\u793a\u4f8b\u7528\u6cd5<\/strong><\/h2>\n<p>birthdate = time.strptime(&quot;1990\/05\/24&quot;, &quot;%Y\/%m\/%d&quot;)<\/p>\n<p>print(f&#39;\u5e74\u9f84\u662f: {calculate_age(birthdate)}&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u5904\u7406\u4e0d\u540c\u7684\u65e5\u671f\u683c\u5f0f\u3002\u901a\u8fc7\u4fee\u6539strptime\u51fd\u6570\u7684\u683c\u5f0f\u5b57\u7b26\u4e32\uff0c\u53ef\u4ee5\u8f7b\u677e\u89e3\u6790\u5404\u79cd\u65e5\u671f\u683c\u5f0f\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528dateutil\u5e93<\/h3>\n<\/p>\n<p><h4>1\u3001\u57fa\u7840\u7528\u6cd5<\/h4>\n<\/p>\n<p><p>dateutil\u5e93\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u7b2c\u4e09\u65b9\u5e93\uff0c\u63d0\u4f9b\u4e86\u6bd4datetime\u6a21\u5757\u66f4\u591a\u7684\u65e5\u671f\u5904\u7406\u529f\u80fd\u3002\u4f7f\u7528\u5b83\u53ef\u4ee5\u7b80\u5316\u5f88\u591a\u590d\u6742\u7684\u65e5\u671f\u8ba1\u7b97\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from dateutil.relativedelta import relativedelta<\/p>\n<p>from datetime import datetime<\/p>\n<p>def calculate_age(birthdate):<\/p>\n<p>    today = datetime.today()<\/p>\n<p>    age = relativedelta(today, birthdate).years<\/p>\n<p>    return age<\/p>\n<h2><strong>\u793a\u4f8b\u7528\u6cd5<\/strong><\/h2>\n<p>birthdate = datetime(1990, 5, 24)<\/p>\n<p>print(f&#39;\u5e74\u9f84\u662f: {calculate_age(birthdate)}&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u5904\u7406\u590d\u6742\u7684\u65e5\u671f\u8ba1\u7b97<\/h4>\n<\/p>\n<p><p>dateutil\u5e93\u7684relativedelta\u7c7b\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u65e5\u671f\u8ba1\u7b97\u529f\u80fd\uff0c\u53ef\u4ee5\u5904\u7406\u66f4\u52a0\u590d\u6742\u7684\u65e5\u671f\u8ba1\u7b97\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from dateutil.relativedelta import relativedelta<\/p>\n<p>from datetime import datetime<\/p>\n<p>def calculate_age(birthdate):<\/p>\n<p>    today = datetime.today()<\/p>\n<p>    delta = relativedelta(today, birthdate)<\/p>\n<p>    age = delta.years<\/p>\n<p>    months = delta.months<\/p>\n<p>    days = delta.days<\/p>\n<p>    return age, months, days<\/p>\n<h2><strong>\u793a\u4f8b\u7528\u6cd5<\/strong><\/h2>\n<p>birthdate = datetime(1990, 5, 24)<\/p>\n<p>age, months, days = calculate_age(birthdate)<\/p>\n<p>print(f&#39;\u5e74\u9f84\u662f: {age}\u5e74{months}\u4e2a\u6708{days}\u5929&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u8ba1\u7b97\u4e00\u4e2a\u4eba\u7684\u5e74\u9f84\uff0c\u5e76\u5305\u62ec\u5e74\u3001\u6708\u3001\u65e5\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u5b9e\u9645\u5e94\u7528\u573a\u666f<\/h3>\n<\/p>\n<p><h4>1\u3001\u751f\u65e5\u63d0\u9192<\/h4>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u8ba1\u7b97\u5e74\u9f84\u7684\u4e00\u4e2a\u5e38\u89c1\u573a\u666f\u662f\u751f\u65e5\u63d0\u9192\u3002\u6211\u4eec\u53ef\u4ee5\u7ed3\u5408datetime\u6a21\u5757\u548c\u5176\u4ed6Python\u5e93\u6765\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from datetime import datetime, timedelta<\/p>\n<p>def days_until_birthday(birthdate):<\/p>\n<p>    today = datetime.today()<\/p>\n<p>    next_birthday = birthdate.replace(year=today.year)<\/p>\n<p>    if next_birthday &lt; today:<\/p>\n<p>        next_birthday = next_birthday.replace(year=today.year + 1)<\/p>\n<p>    return (next_birthday - today).days<\/p>\n<h2><strong>\u793a\u4f8b\u7528\u6cd5<\/strong><\/h2>\n<p>birthdate = datetime(1990, 5, 24)<\/p>\n<p>days = days_until_birthday(birthdate)<\/p>\n<p>print(f&#39;\u8ddd\u79bb\u4e0b\u6b21\u751f\u65e5\u8fd8\u6709: {days}\u5929&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u5458\u5de5\u7ba1\u7406\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728\u5458\u5de5\u7ba1\u7406\u7cfb\u7edf\u4e2d\uff0c\u8ba1\u7b97\u5458\u5de5\u7684\u5e74\u9f84\u662f\u4e00\u4e2a\u5e38\u89c1\u9700\u6c42\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4e0a\u8ff0\u65b9\u6cd5\u6765\u5b9e\u73b0\u8fd9\u4e00\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from datetime import datetime<\/p>\n<p>class Employee:<\/p>\n<p>    def __init__(self, name, birthdate):<\/p>\n<p>        self.name = name<\/p>\n<p>        self.birthdate = birthdate<\/p>\n<p>    def get_age(self):<\/p>\n<p>        today = datetime.today()<\/p>\n<p>        age = today.year - self.birthdate.year - ((today.month, today.day) &lt; (self.birthdate.month, self.birthdate.day))<\/p>\n<p>        return age<\/p>\n<h2><strong>\u793a\u4f8b\u7528\u6cd5<\/strong><\/h2>\n<p>emp = Employee(&quot;\u5f20\u4e09&quot;, datetime(1990, 5, 24))<\/p>\n<p>print(f&#39;{emp.name}\u7684\u5e74\u9f84\u662f: {emp.get_age()}&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u6211\u4eec\u5b66\u4e60\u4e86\u5982\u4f55\u4f7f\u7528datetime\u6a21\u5757\u3001time\u6a21\u5757\u548cdateutil\u5e93\u6765\u8ba1\u7b97\u4e00\u4e2a\u4eba\u7684\u5e74\u9f84\u3002<strong>datetime\u6a21\u5757\u662f\u8ba1\u7b97\u5e74\u9f84\u7684\u9996\u9009\u65b9\u6cd5<\/strong>\uff0c\u56e0\u4e3a\u5b83\u662fPython\u6807\u51c6\u5e93\u7684\u4e00\u90e8\u5206\uff0c\u529f\u80fd\u5f3a\u5927\u4e14\u6613\u4e8e\u4f7f\u7528\u3002<strong>time\u6a21\u5757\u867d\u7136\u4e5f\u80fd\u5b8c\u6210\u4efb\u52a1\uff0c\u4f46\u529f\u80fd\u76f8\u5bf9\u8f83\u5c11<\/strong>\u3002<strong>dateutil\u5e93\u63d0\u4f9b\u4e86\u66f4\u52a0\u7075\u6d3b\u548c\u5f3a\u5927\u7684\u65e5\u671f\u5904\u7406\u529f\u80fd<\/strong>\uff0c\u9002\u5408\u5904\u7406\u590d\u6742\u7684\u65e5\u671f\u8ba1\u7b97\u4efb\u52a1\u3002\u65e0\u8bba\u662f\u751f\u65e5\u63d0\u9192\u8fd8\u662f\u5458\u5de5\u7ba1\u7406\u7cfb\u7edf\uff0c\u672c\u6587\u63d0\u4f9b\u7684\u65b9\u6cd5\u90fd\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u5e74\u9f84\u8ba1\u7b97\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u8ba1\u7b97\u4e00\u4e2a\u4eba\u7684\u5e74\u9f84\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u83b7\u53d6\u7528\u6237\u7684\u51fa\u751f\u65e5\u671f\u548c\u5f53\u524d\u65e5\u671f\u6765\u8ba1\u7b97\u5e74\u9f84\u3002\u4f7f\u7528<code>datetime<\/code>\u6a21\u5757\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u8fd9\u4e00\u70b9\u3002\u9996\u5148\uff0c\u5bfc\u5165<code>datetime<\/code>\u6a21\u5757\uff0c\u7136\u540e\u83b7\u53d6\u5f53\u524d\u65e5\u671f\u5e76\u4e0e\u7528\u6237\u8f93\u5165\u7684\u51fa\u751f\u65e5\u671f\u8fdb\u884c\u6bd4\u8f83\u3002\u53ef\u4ee5\u4f7f\u7528\u7b80\u5355\u7684\u6570\u5b66\u8fd0\u7b97\u6765\u5f97\u5230\u5e74\u9f84\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u53ef\u4ee5\u5b9e\u73b0\u591a\u79cd\u683c\u5f0f\u7684\u51fa\u751f\u65e5\u671f\u8f93\u5165\u5417\uff1f<\/strong><br \/>\u662f\u7684\uff0cPython\u53ef\u4ee5\u5904\u7406\u591a\u79cd\u683c\u5f0f\u7684\u51fa\u751f\u65e5\u671f\u3002\u901a\u8fc7<code>datetime.strptime()<\/code>\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u683c\u5f0f\u7684\u65e5\u671f\u8f6c\u6362\u4e3a<code>datetime<\/code>\u5bf9\u8c61\u3002\u8fd9\u610f\u5473\u7740\u7528\u6237\u53ef\u4ee5\u4ee5\u4e0d\u540c\u7684\u683c\u5f0f\uff08\u5982\u201cYYYY-MM-DD\u201d\u6216\u201cDD\/MM\/YYYY\u201d\uff09\u8f93\u5165\u5176\u51fa\u751f\u65e5\u671f\uff0c\u7a0b\u5e8f\u4ecd\u7136\u80fd\u591f\u6b63\u786e\u89e3\u6790\u5e76\u8ba1\u7b97\u5e74\u9f84\u3002<\/p>\n<p><strong>\u5982\u679c\u7528\u6237\u8f93\u5165\u7684\u51fa\u751f\u65e5\u671f\u4e0d\u6b63\u786e\uff0c\u7a0b\u5e8f\u4f1a\u600e\u6837\u5904\u7406\uff1f<\/strong><br \/>\u4e3a\u4e86\u589e\u5f3a\u7a0b\u5e8f\u7684\u5065\u58ee\u6027\uff0c\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u6dfb\u52a0\u9519\u8bef\u5904\u7406\u673a\u5236\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>try<\/code>\u548c<code>except<\/code>\u8bed\u53e5\u6765\u6355\u6349\u53ef\u80fd\u53d1\u751f\u7684\u5f02\u5e38\uff0c\u5982\u7528\u6237\u8f93\u5165\u7684\u65e5\u671f\u683c\u5f0f\u4e0d\u6b63\u786e\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u63d0\u793a\u7528\u6237\u91cd\u65b0\u8f93\u5165\u6b63\u786e\u7684\u51fa\u751f\u65e5\u671f\u683c\u5f0f\uff0c\u4ece\u800c\u786e\u4fdd\u7a0b\u5e8f\u7684\u987a\u5229\u8fd0\u884c\u3002<\/p>\n<p><strong>\u5e74\u9f84\u8ba1\u7b97\u7ed3\u679c\u662f\u5426\u53ef\u4ee5\u4ee5\u4e0d\u540c\u7684\u5355\u4f4d\u8fd4\u56de\uff1f<\/strong><br \/>\u662f\u7684\uff0c\u9664\u4e86\u4ee5\u5c81\u4e3a\u5355\u4f4d\u8fd4\u56de\u5e74\u9f84\u5916\uff0c\u60a8\u8fd8\u53ef\u4ee5\u8fdb\u4e00\u6b65\u8ba1\u7b97\u51fa\u7528\u6237\u7684\u5e74\u9f84\u4ee5\u6708\u3001\u65e5\u7b49\u5176\u4ed6\u5355\u4f4d\u8868\u793a\u3002\u8fd9\u53ef\u4ee5\u901a\u8fc7\u7b80\u5355\u7684\u6570\u5b66\u8fd0\u7b97\u5b9e\u73b0\uff0c\u5148\u8ba1\u7b97\u51fa\u603b\u5929\u6570\uff0c\u518d\u8f6c\u6362\u4e3a\u6708\u6216\u65e5\u3002\u7528\u6237\u53ef\u4ee5\u6839\u636e\u9700\u8981\u9009\u62e9\u663e\u793a\u7684\u5355\u4f4d\uff0c\u63d0\u4f9b\u66f4\u7075\u6d3b\u7684\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u8ba1\u7b97\u4e00\u4e2a\u4eba\u5e74\u9f84\u7684\u65b9\u6cd5\u6709\u51e0\u79cd\uff0c\u53ef\u4ee5\u4f7f\u7528datetime\u6a21\u5757\u3001time\u6a21\u5757\u3001dateutil\u5e93\u7b49\u3002\u672c\u6587 [&hellip;]","protected":false},"author":3,"featured_media":1144321,"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\/1144304"}],"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=1144304"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1144304\/revisions"}],"predecessor-version":[{"id":1144323,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1144304\/revisions\/1144323"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1144321"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1144304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1144304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1144304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}