{"id":204842,"date":"2025-05-29T15:09:13","date_gmt":"2025-05-29T07:09:13","guid":{"rendered":"https:\/\/server.hk\/cnblog\/204842\/"},"modified":"2025-05-29T15:09:13","modified_gmt":"2025-05-29T07:09:13","slug":"%e5%a6%82%e4%bd%95%e7%94%a8-python-%e7%94%bb%e4%b8%80%e4%b8%aa%e9%80%bc%e7%9c%9f%e7%9a%84%e5%85%ab%e8%a7%92%e5%bd%a2%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/204842\/","title":{"rendered":"\u5982\u4f55\u7528 Python \u753b\u4e00\u4e2a\u903c\u771f\u7684\u516b\u89d2\u5f62\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u7528 Python \u753b\u4e00\u4e2a\u903c\u771f\u7684\u516b\u89d2\u5f62\uff1f<\/h1>\n<p>\u76ee\u524d\u4e0a\u5df2\u7ecf\u6709\u5f88\u591a\u5173\u4e8e\u7684\u6587\u7ae0\u4e86\uff0c\u81ea\u5df1\u5728\u521d\u6b21\u9605\u8bfb\u8fd9\u4e9b\u6587\u7ae0\u4e2d\uff0c\u4e5f\u89c1\u8bc6\u5230\u4e86\u5f88\u591a\u5b66\u4e60\u601d\u8def\uff1b\u90a3\u4e48\u672c\u6587<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5982\u4f55\u7528 Python \u753b\u4e00\u4e2a\u903c\u771f\u7684\u516b\u89d2\u5f62\uff1f\u300b<\/span>\uff0c\u4e5f\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\uff0c\u5982\u679c\u9605\u8bfb\u5b8c\u540e\u771f\u7684\u5bf9\u4f60\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u6709\u5e2e\u52a9\uff0c\u6b22\u8fce\u52a8\u52a8\u624b\u6307\uff0c\u8bc4\u8bba\u7559\u8a00\u5e76\u5206\u4eab~<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241117\/17318349476739b443d7b1a.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u5982\u4f55\u7528 python \u753b\u4e00\u4e2a\u903c\u771f\u7684\u516b\u89d2\u5f62\uff1f<\/strong><\/p>\n<p>\u5f53\u6211\u4eec\u4f7f\u7528 python \u7684 circle() \u51fd\u6570\u65f6\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5b83\u4f1a\u7ed8\u5236\u4e00\u4e2a\u5706\u5f62\u3002\u8981\u753b\u4e00\u4e2a\u516b\u89d2\u5f62\uff0c\u6211\u4eec\u9700\u8981\u7a0d\u4f5c\u4fee\u6539\u3002<\/p>\n<p>\u6765\u770b\u770b\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre>from turtle import *\n\ncircle(40, step = 12)\n\ndone()<\/pre>\n<p>\u8fd9\u4f1a\u7ed8\u5236\u4e00\u4e2a\u516b\u8fb9\u5f62\u800c\u975e\u516b\u89d2\u5f62\u3002\u539f\u56e0\u5728\u4e8e circle() \u51fd\u6570\u7684 step \u53c2\u6570\u6307\u5b9a\u4e86\u5706\u5f27\u4e0a\u7684\u6b65\u957f\u3002\u5bf9\u4e8e\u5706\u5f62\uff0c\u6b65\u957f\u8d8a\u5c0f\uff0c\u5f62\u72b6\u8d8a\u5e73\u6ed1\u3002\u4f46\u5bf9\u4e8e\u5176\u4ed6\u5f62\u72b6\uff0c\u6b65\u957f\u9700\u8981\u4e0e\u5f62\u72b6\u7684\u8fb9\u6570\u76f8\u5bf9\u5e94\u3002<\/p>\n<p>\u8981\u7ed8\u5236\u4e00\u4e2a\u516b\u89d2\u5f62\uff0c\u6211\u4eec\u9700\u8981\u5c06 step \u8bbe\u7f6e\u4e3a 8\u3002\u4fee\u6539\u540e\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>from turtle import *\n\ncircle(40, step = 8)\n\ndone()<\/pre>\n<p>\u73b0\u5728\uff0c\u5b83\u5c06\u7ed8\u5236\u4e00\u4e2a\u516b\u89d2\u5f62\u3002<\/p>\n<p>\u4e3a\u4e86\u8ba9\u516b\u89d2\u5f62\u770b\u8d77\u6765\u66f4\u903c\u771f\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8c03\u6574\u5176\u4ed6\u53c2\u6570\u6765\u6dfb\u52a0\u4e00\u4e9b\u7ec6\u8282\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a<\/p>\n<pre>import turtle\n\nturtle.pensize(2)\nturtle.color('red')\n\n# \u7ed8\u5236\u516b\u89d2\u5f62\nfor i in range(8):\n    turtle.forward(100)\n    turtle.right(45)\n\n# \u4e3a\u4e86\u8ba9\u7ed8\u5236\u7684\u516b\u89d2\u5f62\u91cd\u53e0\u5728\u4e00\u8d77\uff0c\u9700\u8981\u65cb\u8f6c\u4e00\u5b9a\u89d2\u5ea6\nturtle.right(22.5)\n\n# \u7ed8\u5236\u5185\u90e8\u7684\u516b\u89d2\u5f62\nfor j in range(8):\n    turtle.forward(58)\n    turtle.right(45)\n\nturtle.done()<\/pre>\n<p>\u6b64\u4ee3\u7801\u4f1a\u7ed8\u5236\u4e00\u4e2a\u91cd\u53e0\u7684\u516b\u89d2\u5f62\uff0c\u4f7f\u5176\u770b\u8d77\u6765\u66f4\u52a0\u903c\u771f\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300a\u5982\u4f55\u7528 Python \u753b\u4e00\u4e2a\u903c\u771f\u7684\u516b\u89d2\u5f62\uff1f\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u7528 Python \u753b\u4e00\u4e2a\u903c\u771f&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-204842","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204842","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=204842"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204842\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=204842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=204842"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=204842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}