{"id":291,"date":"2025-10-10T15:10:29","date_gmt":"2025-10-10T07:10:29","guid":{"rendered":"http:\/\/www.pyteam.cn\/?p=291"},"modified":"2025-10-10T15:10:30","modified_gmt":"2025-10-10T07:10:30","slug":"%e5%af%bc%e5%85%a5%e6%a8%a1%e5%9d%97%e4%b8%8e%e5%88%9b%e5%bb%ba%e6%b5%b7%e9%be%9f-10-1","status":"publish","type":"post","link":"http:\/\/www.pyteam.cn\/index.php\/2025\/10\/10\/%e5%af%bc%e5%85%a5%e6%a8%a1%e5%9d%97%e4%b8%8e%e5%88%9b%e5%bb%ba%e6%b5%b7%e9%be%9f-10-1\/","title":{"rendered":"\u5bfc\u5165\u6a21\u5757\u4e0e\u521b\u5efa\u6d77\u9f9f 10.1"},"content":{"rendered":"\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:clamp(18px, 1.125rem, 27px);font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#90A4AE;--cbp-line-number-width:calc(1 * 0.6 * 1.125rem);line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#ededed;color:#8198a3\">Python<\/span><span role=\"button\" tabindex=\"0\" style=\"color:#90A4AE;display:none\" aria-label=\"\u590d\u5236\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly># \u5bfc\u5165turtle\u6a21\u5757\uff0c\u5e76\u7ed9\u5b83\u8d77\u4e2a\u7b80\u5355\u7684\u522b\u540d't'\nimport turtle as t\n\n# \u521b\u5efa\u4e00\u4e2a\u6d77\u9f9f\u5bf9\u8c61\uff0c\u6211\u4eec\u7ed9\u5b83\u53d6\u540d\u53eb'pen'\uff08\u753b\u7b14\uff09\npen = t.Turtle()\n\n# \u53ef\u9009\uff1a\u9690\u85cf\u6d77\u9f9f\u7684\u7bad\u5934\u5f62\u72b6\uff0c\u8ba9\u5b83\u53ea\u7559\u4e0b\u753b\u7b14\u7684\u75d5\u8ff9\npen.hideturtle()<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-lighter\" style=\"background-color: #FAFAFA\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #90A4AE; font-style: italic\"># \u5bfc\u5165turtle\u6a21\u5757\uff0c\u5e76\u7ed9\u5b83\u8d77\u4e2a\u7b80\u5355\u7684\u522b\u540d&#39;t&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #39ADB5; font-style: italic\">import<\/span><span style=\"color: #90A4AE\"> turtle <\/span><span style=\"color: #39ADB5; font-style: italic\">as<\/span><span style=\"color: #90A4AE\"> t<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE; font-style: italic\"># \u521b\u5efa\u4e00\u4e2a\u6d77\u9f9f\u5bf9\u8c61\uff0c\u6211\u4eec\u7ed9\u5b83\u53d6\u540d\u53eb&#39;pen&#39;\uff08\u753b\u7b14\uff09<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">pen <\/span><span style=\"color: #39ADB5\">=<\/span><span style=\"color: #90A4AE\"> t<\/span><span style=\"color: #39ADB5\">.<\/span><span style=\"color: #6182B8\">Turtle<\/span><span style=\"color: #39ADB5\">()<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE; font-style: italic\"># \u53ef\u9009\uff1a\u9690\u85cf\u6d77\u9f9f\u7684\u7bad\u5934\u5f62\u72b6\uff0c\u8ba9\u5b83\u53ea\u7559\u4e0b\u753b\u7b14\u7684\u75d5\u8ff9<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">pen<\/span><span style=\"color: #39ADB5\">.<\/span><span style=\"color: #6182B8\">hideturtle<\/span><span style=\"color: #39ADB5\">()<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":68,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,5],"tags":[],"class_list":["post-291","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-turtle","category-5"],"views":122,"_links":{"self":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts\/291","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/comments?post=291"}],"version-history":[{"count":1,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts\/291\/revisions"}],"predecessor-version":[{"id":292,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts\/291\/revisions\/292"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/media\/68"}],"wp:attachment":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/media?parent=291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/categories?post=291"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/tags?post=291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}