{"id":1130064,"date":"2025-01-08T20:35:34","date_gmt":"2025-01-08T12:35:34","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1130064.html"},"modified":"2025-01-08T20:35:36","modified_gmt":"2025-01-08T12:35:36","slug":"%e5%a6%82%e4%bd%95%e5%88%a4%e6%96%ad%e4%b8%a4%e4%b8%aa%e7%89%a9%e4%bd%93%e7%9a%84%e7%a2%b0%e6%92%9e%e9%9d%a2python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1130064.html","title":{"rendered":"\u5982\u4f55\u5224\u65ad\u4e24\u4e2a\u7269\u4f53\u7684\u78b0\u649e\u9762python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25100255\/7714e122-dc86-4f6a-b34f-74f7e00c46a8.webp\" alt=\"\u5982\u4f55\u5224\u65ad\u4e24\u4e2a\u7269\u4f53\u7684\u78b0\u649e\u9762python\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\u5224\u65ad\u4e24\u4e2a\u7269\u4f53\u7684\u78b0\u649e\u9762\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u5b9e\u73b0\uff0c\u5e38\u89c1\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u77e9\u5f62\u5305\u56f4\u76d2\u3001\u4f7f\u7528\u591a\u8fb9\u5f62\u78b0\u649e\u68c0\u6d4b\u7b97\u6cd5\u3001\u4f7f\u7528\u7269\u7406\u5f15\u64ce\u7b49\u3002<\/strong> \u5176\u4e2d\uff0c\u77e9\u5f62\u5305\u56f4\u76d2\u65b9\u6cd5\u6700\u7b80\u5355\u4e14\u9002\u5408\u5927\u591a\u65702D\u6e38\u620f\u5e94\u7528\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u77e9\u5f62\u5305\u56f4\u76d2\u6765\u5224\u65ad\u4e24\u4e2a\u7269\u4f53\u7684\u78b0\u649e\u9762\uff0c\u5e76\u5c55\u793a\u76f8\u5173\u4ee3\u7801\u793a\u4f8b\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u77e9\u5f62\u5305\u56f4\u76d2\u65b9\u6cd5<\/h3>\n<\/p>\n<p><p>\u77e9\u5f62\u5305\u56f4\u76d2\uff08Bounding Box\uff09\u65b9\u6cd5\u662f\u6700\u5e38\u7528\u7684\u78b0\u649e\u68c0\u6d4b\u6280\u672f\u4e4b\u4e00\u3002\u5b83\u901a\u8fc7\u5c06\u7269\u4f53\u7528\u4e00\u4e2a\u77e9\u5f62\u6846\u8d77\u6765\uff0c\u7136\u540e\u5224\u65ad\u4e24\u4e2a\u77e9\u5f62\u662f\u5426\u76f8\u4ea4\u3002<strong>\u8fd9\u79cd\u65b9\u6cd5\u7b80\u5355\u9ad8\u6548\uff0c\u9002\u5408\u7528\u4e8e\u5927\u591a\u65702D\u6e38\u620f\u548c\u5e94\u7528\u4e2d\u3002<\/strong><\/p>\n<\/p>\n<p><h4>1. \u77e9\u5f62\u5305\u56f4\u76d2\u5b9a\u4e49<\/h4>\n<\/p>\n<p><p>\u77e9\u5f62\u5305\u56f4\u76d2\u7531\u56db\u4e2a\u53c2\u6570\u5b9a\u4e49\uff1a\u5de6\u4e0a\u89d2\u7684\u5750\u6807 (x, y) \u548c\u77e9\u5f62\u7684\u5bbd\u5ea6\uff08width\uff09\u548c\u9ad8\u5ea6\uff08height\uff09\u3002\u5728Python\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e2a\u7c7b\u6765\u5b9a\u4e49\u77e9\u5f62\u5305\u56f4\u76d2\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">class BoundingBox:<\/p>\n<p>    def __init__(self, x, y, width, height):<\/p>\n<p>        self.x = x<\/p>\n<p>        self.y = y<\/p>\n<p>        self.width = width<\/p>\n<p>        self.height = height<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u78b0\u649e\u68c0\u6d4b\u7b97\u6cd5<\/h4>\n<\/p>\n<p><p>\u8981\u5224\u65ad\u4e24\u4e2a\u77e9\u5f62\u662f\u5426\u76f8\u4ea4\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u7b97\u6cd5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def is_collision(box1, box2):<\/p>\n<p>    if (box1.x &lt; box2.x + box2.width and<\/p>\n<p>        box1.x + box1.width &gt; box2.x and<\/p>\n<p>        box1.y &lt; box2.y + box2.height and<\/p>\n<p>        box1.y + box1.height &gt; box2.y):<\/p>\n<p>        return True<\/p>\n<p>    else:<\/p>\n<p>        return False<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><p>\u4e0b\u9762\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u793a\u4f8b\u4ee3\u7801\uff0c\u5c55\u793a\u5982\u4f55\u4f7f\u7528\u77e9\u5f62\u5305\u56f4\u76d2\u8fdb\u884c\u78b0\u649e\u68c0\u6d4b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">class BoundingBox:<\/p>\n<p>    def __init__(self, x, y, width, height):<\/p>\n<p>        self.x = x<\/p>\n<p>        self.y = y<\/p>\n<p>        self.width = width<\/p>\n<p>        self.height = height<\/p>\n<p>def is_collision(box1, box2):<\/p>\n<p>    if (box1.x &lt; box2.x + box2.width and<\/p>\n<p>        box1.x + box1.width &gt; box2.x and<\/p>\n<p>        box1.y &lt; box2.y + box2.height and<\/p>\n<p>        box1.y + box1.height &gt; box2.y):<\/p>\n<p>        return True<\/p>\n<p>    else:<\/p>\n<p>        return False<\/p>\n<h2><strong>\u5b9a\u4e49\u4e24\u4e2a\u77e9\u5f62<\/strong><\/h2>\n<p>box1 = BoundingBox(10, 10, 50, 50)<\/p>\n<p>box2 = BoundingBox(30, 30, 50, 50)<\/p>\n<h2><strong>\u68c0\u67e5\u662f\u5426\u78b0\u649e<\/strong><\/h2>\n<p>if is_collision(box1, box2):<\/p>\n<p>    print(&quot;\u78b0\u649e\u68c0\u6d4b\uff1a\u4e24\u4e2a\u7269\u4f53\u53d1\u751f\u4e86\u78b0\u649e&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;\u78b0\u649e\u68c0\u6d4b\uff1a\u4e24\u4e2a\u7269\u4f53\u672a\u53d1\u751f\u78b0\u649e&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u591a\u8fb9\u5f62\u78b0\u649e\u68c0\u6d4b\u65b9\u6cd5<\/h3>\n<\/p>\n<p><p>\u5bf9\u4e8e\u66f4\u590d\u6742\u7684\u5f62\u72b6\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u8fb9\u5f62\u78b0\u649e\u68c0\u6d4b\u7b97\u6cd5\uff0c\u5982Separating Axis Theorem (SAT)\u3002<strong>\u8fd9\u79cd\u65b9\u6cd5\u9002\u5408\u4e8e\u4e0d\u89c4\u5219\u5f62\u72b6\u7684\u78b0\u649e\u68c0\u6d4b\u3002<\/strong><\/p>\n<\/p>\n<p><h4>1. \u591a\u8fb9\u5f62\u5b9a\u4e49<\/h4>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e2a\u5217\u8868\u6765\u5b9a\u4e49\u591a\u8fb9\u5f62\u7684\u9876\u70b9\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">class Polygon:<\/p>\n<p>    def __init__(self, vertices):<\/p>\n<p>        self.vertices = vertices<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u78b0\u649e\u68c0\u6d4b\u7b97\u6cd5<\/h4>\n<\/p>\n<p><p>SAT\u7b97\u6cd5\u7684\u57fa\u672c\u601d\u60f3\u662f\uff0c\u5982\u679c\u4e24\u4e2a\u591a\u8fb9\u5f62\u4e0d\u76f8\u4ea4\uff0c\u90a3\u4e48\u4e00\u5b9a\u5b58\u5728\u4e00\u6761\u5206\u79bb\u8f74\uff0c\u4f7f\u5f97\u5728\u8fd9\u6761\u8f74\u4e0a\u6295\u5f71\u7684\u4e24\u4e2a\u591a\u8fb9\u5f62\u4e0d\u91cd\u53e0\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>def project_polygon(axis, polygon):<\/p>\n<p>    dots = [np.dot(vertex, axis) for vertex in polygon.vertices]<\/p>\n<p>    return [min(dots), max(dots)]<\/p>\n<p>def is_overlapping(proj1, proj2):<\/p>\n<p>    return proj1[0] &lt;= proj2[1] and proj2[0] &lt;= proj1[1]<\/p>\n<p>def is_collision(polygon1, polygon2):<\/p>\n<p>    for polygon in [polygon1, polygon2]:<\/p>\n<p>        for i in range(len(polygon.vertices)):<\/p>\n<p>            p1 = polygon.vertices[i]<\/p>\n<p>            p2 = polygon.vertices[(i + 1) % len(polygon.vertices)]<\/p>\n<p>            edge = np.subtract(p2, p1)<\/p>\n<p>            axis = np.array([-edge[1], edge[0]])<\/p>\n<p>            proj1 = project_polygon(axis, polygon1)<\/p>\n<p>            proj2 = project_polygon(axis, polygon2)<\/p>\n<p>            if not is_overlapping(proj1, proj2):<\/p>\n<p>                return False<\/p>\n<p>    return True<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><p>\u4e0b\u9762\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u793a\u4f8b\u4ee3\u7801\uff0c\u5c55\u793a\u5982\u4f55\u4f7f\u7528SAT\u7b97\u6cd5\u8fdb\u884c\u591a\u8fb9\u5f62\u78b0\u649e\u68c0\u6d4b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>class Polygon:<\/p>\n<p>    def __init__(self, vertices):<\/p>\n<p>        self.vertices = vertices<\/p>\n<p>def project_polygon(axis, polygon):<\/p>\n<p>    dots = [np.dot(vertex, axis) for vertex in polygon.vertices]<\/p>\n<p>    return [min(dots), max(dots)]<\/p>\n<p>def is_overlapping(proj1, proj2):<\/p>\n<p>    return proj1[0] &lt;= proj2[1] and proj2[0] &lt;= proj1[1]<\/p>\n<p>def is_collision(polygon1, polygon2):<\/p>\n<p>    for polygon in [polygon1, polygon2]:<\/p>\n<p>        for i in range(len(polygon.vertices)):<\/p>\n<p>            p1 = polygon.vertices[i]<\/p>\n<p>            p2 = polygon.vertices[(i + 1) % len(polygon.vertices)]<\/p>\n<p>            edge = np.subtract(p2, p1)<\/p>\n<p>            axis = np.array([-edge[1], edge[0]])<\/p>\n<p>            proj1 = project_polygon(axis, polygon1)<\/p>\n<p>            proj2 = project_polygon(axis, polygon2)<\/p>\n<p>            if not is_overlapping(proj1, proj2):<\/p>\n<p>                return False<\/p>\n<p>    return True<\/p>\n<h2><strong>\u5b9a\u4e49\u4e24\u4e2a\u591a\u8fb9\u5f62<\/strong><\/h2>\n<p>polygon1 = Polygon([(1, 1), (5, 1), (4, 4), (1, 5)])<\/p>\n<p>polygon2 = Polygon([(2, 2), (6, 2), (5, 5), (2, 6)])<\/p>\n<h2><strong>\u68c0\u67e5\u662f\u5426\u78b0\u649e<\/strong><\/h2>\n<p>if is_collision(polygon1, polygon2):<\/p>\n<p>    print(&quot;\u78b0\u649e\u68c0\u6d4b\uff1a\u4e24\u4e2a\u7269\u4f53\u53d1\u751f\u4e86\u78b0\u649e&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;\u78b0\u649e\u68c0\u6d4b\uff1a\u4e24\u4e2a\u7269\u4f53\u672a\u53d1\u751f\u78b0\u649e&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u7269\u7406\u5f15\u64ce<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u66f4\u590d\u6742\u548c\u7cbe\u786e\u7684\u7269\u7406\u6a21\u62df\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u4e2d\u7684\u7269\u7406\u5f15\u64ce\uff0c\u5982Pygame\u3001Pymunk\u3001Box2D\u7b49\u3002<strong>\u8fd9\u4e9b\u5f15\u64ce\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u7269\u7406\u6a21\u62df\u529f\u80fd\uff0c\u5305\u62ec\u78b0\u649e\u68c0\u6d4b\u3001\u78b0\u649e\u54cd\u5e94\u3001\u91cd\u529b\u7b49\u3002<\/strong><\/p>\n<\/p>\n<p><h4>1. Pygame<\/h4>\n<\/p>\n<p><p>Pygame\u662f\u4e00\u4e2a\u7b80\u5355\u76842D\u6e38\u620f\u5f15\u64ce\uff0c\u9002\u5408\u521d\u5b66\u8005\u3002\u5b83\u5305\u542b\u4e86\u57fa\u672c\u7684\u78b0\u649e\u68c0\u6d4b\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pygame<\/p>\n<p>pygame.init()<\/p>\n<p>screen = pygame.display.set_mode((640, 480))<\/p>\n<h2><strong>\u5b9a\u4e49\u4e24\u4e2a\u77e9\u5f62<\/strong><\/h2>\n<p>rect1 = pygame.Rect(10, 10, 50, 50)<\/p>\n<p>rect2 = pygame.Rect(30, 30, 50, 50)<\/p>\n<h2><strong>\u68c0\u67e5\u662f\u5426\u78b0\u649e<\/strong><\/h2>\n<p>if rect1.colliderect(rect2):<\/p>\n<p>    print(&quot;\u78b0\u649e\u68c0\u6d4b\uff1a\u4e24\u4e2a\u7269\u4f53\u53d1\u751f\u4e86\u78b0\u649e&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;\u78b0\u649e\u68c0\u6d4b\uff1a\u4e24\u4e2a\u7269\u4f53\u672a\u53d1\u751f\u78b0\u649e&quot;)<\/p>\n<p>pygame.quit()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. Pymunk<\/h4>\n<\/p>\n<p><p>Pymunk\u662f\u4e00\u4e2a\u57fa\u4e8eChipmunk\u76842D\u7269\u7406\u5f15\u64ce\uff0c\u63d0\u4f9b\u4e86\u66f4\u590d\u6742\u7684\u7269\u7406\u6a21\u62df\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pymunk<\/p>\n<p>import pymunk.pygame_util<\/p>\n<p>import pygame<\/p>\n<p>def create_box(space, pos, size):<\/p>\n<p>    body = pymunk.Body(1, pymunk.inf)<\/p>\n<p>    body.position = pos<\/p>\n<p>    shape = pymunk.Poly.create_box(body, size)<\/p>\n<p>    space.add(body, shape)<\/p>\n<p>    return shape<\/p>\n<p>pygame.init()<\/p>\n<p>screen = pygame.display.set_mode((640, 480))<\/p>\n<p>clock = pygame.time.Clock()<\/p>\n<p>space = pymunk.Space()<\/p>\n<p>space.gravity = (0, -900)<\/p>\n<p>box1 = create_box(space, (100, 400), (50, 50))<\/p>\n<p>box2 = create_box(space, (200, 400), (50, 50))<\/p>\n<p>draw_options = pymunk.pygame_util.DrawOptions(screen)<\/p>\n<p>running = True<\/p>\n<p>while running:<\/p>\n<p>    for event in pygame.event.get():<\/p>\n<p>        if event.type == pygame.QUIT:<\/p>\n<p>            running = False<\/p>\n<p>    screen.fill((255, 255, 255))<\/p>\n<p>    space.step(1\/60.0)<\/p>\n<p>    space.debug_draw(draw_options)<\/p>\n<p>    pygame.display.flip()<\/p>\n<p>    clock.tick(60)<\/p>\n<p>pygame.quit()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u78b0\u649e\u68c0\u6d4b\u5728\u6e38\u620f\u5f00\u53d1\u548c\u7269\u7406\u6a21\u62df\u4e2d\u662f\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u6280\u672f\u3002<strong>\u901a\u8fc7\u4f7f\u7528\u77e9\u5f62\u5305\u56f4\u76d2\u3001\u591a\u8fb9\u5f62\u78b0\u649e\u68c0\u6d4b\u7b97\u6cd5\u4ee5\u53ca\u7269\u7406\u5f15\u64ce\uff0c\u53ef\u4ee5\u5b9e\u73b0\u4e0d\u540c\u590d\u6742\u7a0b\u5ea6\u7684\u78b0\u649e\u68c0\u6d4b\u3002<\/strong> \u77e9\u5f62\u5305\u56f4\u76d2\u65b9\u6cd5\u7b80\u5355\u9ad8\u6548\uff0c\u9002\u5408\u5927\u591a\u65702D\u6e38\u620f\u5e94\u7528\u3002\u591a\u8fb9\u5f62\u78b0\u649e\u68c0\u6d4b\u7b97\u6cd5\u9002\u7528\u4e8e\u4e0d\u89c4\u5219\u5f62\u72b6\u7684\u78b0\u649e\u68c0\u6d4b\uff0c\u800c\u7269\u7406\u5f15\u64ce\u5219\u63d0\u4f9b\u4e86\u66f4\u590d\u6742\u548c\u7cbe\u786e\u7684\u7269\u7406\u6a21\u62df\u529f\u80fd\u3002\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u5e94\u7528\u573a\u666f\u548c\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u672c\u6587\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u76f8\u4fe1\u4f60\u5df2\u7ecf\u638c\u63e1\u4e86\u5982\u4f55\u5728Python\u4e2d\u5224\u65ad\u4e24\u4e2a\u7269\u4f53\u7684\u78b0\u649e\u9762\u3002\u5e0c\u671b\u8fd9\u4e9b\u5185\u5bb9\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u68c0\u6d4b\u4e24\u4e2a\u7269\u4f53\u7684\u78b0\u649e\u9762\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u7269\u7406\u5f15\u64ce\u5e93\u5982Pygame\u6216PyBullet\u6765\u68c0\u6d4b\u4e24\u4e2a\u7269\u4f53\u7684\u78b0\u649e\u9762\u3002\u8fd9\u4e9b\u5e93\u63d0\u4f9b\u4e86\u529f\u80fd\u5f3a\u5927\u7684\u78b0\u649e\u68c0\u6d4b\u7b97\u6cd5\uff0c\u80fd\u591f\u6709\u6548\u5730\u8bc6\u522b\u7269\u4f53\u7684\u8fb9\u754c\u5e76\u5224\u65ad\u662f\u5426\u53d1\u751f\u78b0\u649e\u3002\u5177\u4f53\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528\u8fb9\u754c\u6846\u3001\u5706\u5f62\u78b0\u649e\u68c0\u6d4b\u6216\u591a\u8fb9\u5f62\u78b0\u649e\u68c0\u6d4b\u7b49\u3002<\/p>\n<p><strong>\u5728\u78b0\u649e\u68c0\u6d4b\u4e2d\uff0c\u5982\u4f55\u8868\u793a\u7269\u4f53\u7684\u5f62\u72b6\u548c\u8fb9\u754c\uff1f<\/strong><br \/>\u7269\u4f53\u7684\u5f62\u72b6\u548c\u8fb9\u754c\u901a\u5e38\u53ef\u4ee5\u901a\u8fc7\u51e0\u4f55\u56fe\u5f62\u6765\u8868\u793a\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u77e9\u5f62\u3001\u5706\u5f62\u6216\u591a\u8fb9\u5f62\u7684\u5750\u6807\u6765\u5b9a\u4e49\u7269\u4f53\u7684\u8fb9\u754c\u3002\u901a\u8fc7\u8ba1\u7b97\u8fd9\u4e9b\u8fb9\u754c\u7684\u4ea4\u96c6\uff0c\u53ef\u4ee5\u5224\u65ad\u4e24\u4e2a\u7269\u4f53\u662f\u5426\u53d1\u751f\u78b0\u649e\u3002\u4f8b\u5982\uff0c\u77e9\u5f62\u7684\u8fb9\u754c\u53ef\u4ee5\u901a\u8fc7\u5176\u5de6\u4e0a\u89d2\u548c\u53f3\u4e0b\u89d2\u5750\u6807\u6765\u8868\u793a\uff0c\u800c\u5706\u5f62\u53ef\u4ee5\u901a\u8fc7\u5176\u4e2d\u5fc3\u548c\u534a\u5f84\u6765\u5b9a\u4e49\u3002<\/p>\n<p><strong>\u5982\u4f55\u63d0\u9ad8\u78b0\u649e\u68c0\u6d4b\u7684\u6548\u7387\uff1f<\/strong><br \/>\u63d0\u9ad8\u78b0\u649e\u68c0\u6d4b\u7684\u6548\u7387\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\u3002\u4f7f\u7528\u7a7a\u95f4\u5212\u5206\u6280\u672f\uff08\u5982\u56db\u53c9\u6811\u6216\u516b\u53c9\u6811\uff09\u53ef\u4ee5\u6709\u6548\u51cf\u5c11\u9700\u8981\u68c0\u6d4b\u7684\u7269\u4f53\u6570\u91cf\u3002\u6b64\u5916\uff0c\u91c7\u7528\u7b80\u5355\u7684\u5f62\u72b6\uff08\u5982\u8fb9\u754c\u6846\uff09\u8fdb\u884c\u521d\u6b65\u68c0\u6d4b\uff0c\u53ea\u6709\u5728\u53d1\u751f\u78b0\u649e\u65f6\u624d\u8fdb\u884c\u66f4\u590d\u6742\u7684\u5f62\u72b6\u68c0\u6d4b\uff0c\u4e5f\u80fd\u663e\u8457\u63d0\u9ad8\u6548\u7387\u3002\u4f7f\u7528\u8fd9\u4e9b\u6280\u672f\u53ef\u4ee5\u4f7f\u78b0\u649e\u68c0\u6d4b\u5728\u5927\u578b\u573a\u666f\u4e2d\u4ecd\u7136\u4fdd\u6301\u826f\u597d\u7684\u6027\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u5224\u65ad\u4e24\u4e2a\u7269\u4f53\u7684\u78b0\u649e\u9762\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u5b9e\u73b0\uff0c\u5e38\u89c1\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u77e9\u5f62\u5305\u56f4\u76d2\u3001\u4f7f\u7528\u591a\u8fb9\u5f62\u78b0\u649e\u68c0\u6d4b\u7b97 [&hellip;]","protected":false},"author":3,"featured_media":1130071,"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\/1130064"}],"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=1130064"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1130064\/revisions"}],"predecessor-version":[{"id":1130073,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1130064\/revisions\/1130073"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1130071"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1130064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1130064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1130064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}