{"id":5475,"date":"2022-04-02T21:28:31","date_gmt":"2022-04-02T13:28:31","guid":{"rendered":"https:\/\/egonlin.com\/?p=5475"},"modified":"2022-04-02T21:28:31","modified_gmt":"2022-04-02T13:28:31","slug":"03-05-%e6%96%87%e6%9c%ac%e8%bf%9b%e5%ba%a6%e6%9d%a1%e9%97%ae%e9%a2%98%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=5475","title":{"rendered":"03-05 \u201c\u6587\u672c\u8fdb\u5ea6\u6761\u201d\u95ee\u9898\u5206\u6790"},"content":{"rendered":"<h1>\u4e00\u3001&quot;\u6587\u672c\u8fdb\u5ea6\u6761&quot;\u95ee\u9898\u5206\u6790<\/h1>\n<h2>1.1 \u6587\u672c\u8fdb\u5ea6\u6761<\/h2>\n<p>\u7528\u8fc7\u8ba1\u7b97\u673a\u7684\u90fd\u89c1\u8fc7<\/p>\n<ul>\n<li>\u8fdb\u5ea6\u6761\u4ec0\u4e48\u539f\u7406\u5462\uff1f<\/li>\n<\/ul>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/\u6587\u672c\u8fdb\u5ea6\u6761\u95ee\u9898\u5206\u67901.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/\u6587\u672c\u8fdb\u5ea6\u6761\u95ee\u9898\u5206\u67901.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h2>1.2 \u9700\u6c42\u5206\u6790<\/h2>\n<ul>\n<li>\u91c7\u7528\u5b57\u7b26\u4e32\u65b9\u5f0f\u6253\u5370\u53ef\u4ee5\u52a8\u6001\u53d8\u5316\u7684\u6587\u672c\u8fdb\u5ea6\u6761<\/li>\n<li>\u8fdb\u5ea6\u6761\u9700\u8981\u80fd\u5728\u4e00\u884c\u4e2d\u9010\u6e10\u53d8\u5316<\/li>\n<\/ul>\n<h2>1.3 \u95ee\u9898\u5206\u6790<\/h2>\n<p>\u5982\u4f55\u83b7\u5f97\u6587\u672c\u8fdb\u5ea6\u6761\u7684\u53d8\u5316\u65f6\u95f4\uff1f<\/p>\n<ul>\n<li>\u91c7\u7528sleep()\u6a21\u62df\u4e00\u4e2a\u6301\u7eed\u7684\u8fdb\u5ea6<\/li>\n<li>\u4f3c\u4e4e\u4e0d\u90a3\u4e48\u96be<\/li>\n<\/ul>\n<h1>\u4e8c\u3001&quot;\u6587\u672c\u8fdb\u5ea6\u6761&quot;\u7b80\u5355\u7684\u5f00\u59cb<\/h1>\n<h2>2.1 \u7b80\u5355\u7684\u5f00\u59cb<\/h2>\n<pre><code class=\"language-python\"># TextProBarV1.py\n\nimport time\n\nscale = 10\nprint(&quot;------\u6267\u884c\u5f00\u59cb------&quot;)\nfor i in range(scale + 1):\n    a = &#039;*&#039; * i\n    b = &#039;.&#039; * (scale - i)\n    c = (i \/ scale) * 100\n    print(&quot;{:^3.0f}%[{}-&gt;{}]&quot;.format(c, a, b))\n    time.sleep(0.1)\nprint(&quot;------\u6267\u884c\u7ed3\u675f------&quot;)<\/code><\/pre>\n<h1>\u4e09\u3001&quot;\u6587\u672c\u8fdb\u5ea6\u6761&quot;\u5355\u884c\u52a8\u6001\u5237\u65b0<\/h1>\n<h2>3.1 \u5355\u884c\u52a8\u6001\u5237\u65b0<\/h2>\n<p>\u5237\u65b0\u7684\u5173\u952e\u662f <code>\\r<\/code><\/p>\n<ul>\n<li>\u5237\u65b0\u7684\u672c\u8d28\u662f\uff1a\u7528\u540e\u6253\u5370\u7684\u5b57\u7b26\u8986\u76d6\u4e4b\u524d\u7684\u5b57\u7b26<\/li>\n<li>\u4e0d\u80fd\u6362\u884c\uff1a<code>print()<\/code>\u9700\u8981\u88ab\u63a7\u5236<\/li>\n<li>\u8981\u80fd\u56de\u9000\uff1a\u6253\u5370\u540e\u5149\u6807\u9000\u56de\u5230\u4e4b\u524d\u7684\u4f4d\u7f6e <code>\\r<\/code><\/li>\n<\/ul>\n<p>\u6ce8\u610f\uff1a<strong>IDLE\u5982Pycharm\u5c4f\u853d\u4e86\\r\u529f\u80fd<\/strong><\/p>\n<pre><code class=\"language-python\">import time\n\nfor i in range(101):\n    print(&quot;\\r{:3}%&quot;.format(i), end=&quot;&quot;)\n    time.sleep(0.1)<\/code><\/pre>\n<h1>\u56db\u3001&quot;\u6587\u672c\u8fdb\u5ea6\u6761&quot;\u5b9e\u4f8b\u5b8c\u6574\u6548\u679c<\/h1>\n<pre><code class=\"language-python\">import time\n\nscale = 100\nprint(&quot;\u6267\u884c\u5f00\u59cb&quot;.center(scale \/\/ 2, &quot;-&quot;))\nstart = time.perf_counter()\nfor i in range(scale + 1):\n    a = &#039;*&#039; * i\n    b = &#039;.&#039; * (scale - i)\n    c = (i \/ scale) * 100\n    dur = time.perf_counter() - start\n    print(&quot;\\r{:^3.0f}%[{}-&gt;{}]{:.2f}s&quot;.format(c, a, b, dur), end=&#039;&#039;)\n    time.sleep(0.1)\nprint(&quot;\\n&quot; + &quot;\u6267\u884c\u7ed3\u675f&quot;.center(scale \/\/ 2, &#039;-&#039;))<\/code><\/pre>\n<h1>\u4e94\u3001&quot;\u6587\u672c\u8fdb\u5ea6\u6761&quot;\u4e3e\u4e00\u53cd\u4e09<\/h1>\n<h2>5.1 \u4e3e\u4e00\u53cd\u4e09<\/h2>\n<p>\u8ba1\u7b97\u95ee\u9898\u6269\u5c55<\/p>\n<ul>\n<li>\u6587\u672c\u8fdb\u5ea6\u6761\u7a0b\u5e8f\u4f7f\u7528\u4e86<code>perf_counter()<\/code>\u8ba1\u65f6<\/li>\n<li>\u8ba1\u65f6\u65b9\u6cd5\u9002\u5408\u5404\u7c7b\u9700\u8981\u7edf\u8ba1\u65f6\u95f4\u7684\u8ba1\u7b97\u95ee\u9898<\/li>\n<li>\u4f8b\u5982\uff1a\u6bd4\u8f83\u4e0d\u540c\u7b97\u6cd5\u65f6\u95f4\u3001\u7edf\u8ba1\u90e8\u5206\u7a0b\u5e8f\u8fd0\u884c\u65f6\u95f4<\/li>\n<\/ul>\n<p>\u8fdb\u5ea6\u6761\u5e94\u7528<\/p>\n<ul>\n<li>\u5728\u4efb\u4f55\u8fd0\u884c\u65f6\u95f4\u9700\u8981\u8f83\u957f\u7684\u7a0b\u5e8f\u4e2d\u589e\u52a0\u8fdb\u5ea6\u6761<\/li>\n<li>\u5728\u4efb\u4f55\u5e0c\u671b\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\u7684\u5e94\u7528\u4e2d\u589e\u52a0\u8fdb\u5ea6\u6761<\/li>\n<li>\u8fdb\u5ea6\u6761\u662f\u4eba\u673a\u4ea4\u4e92\u7684\u7ebd\u5e26\u4e4b<\/li>\n<\/ul>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/\u6587\u672c\u8fdb\u5ea6\u6761\u95ee\u9898\u5206\u67902.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/\u6587\u672c\u8fdb\u5ea6\u6761\u95ee\u9898\u5206\u67902.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<p>\u6587\u672c\u8fdb\u5ea6\u6761\u7684\u4e0d\u540c\u8bbe\u8ba1\u51fd\u6570<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u8bbe\u8ba1\u540d\u79f0<\/th>\n<th style=\"text-align: center;\">\u8d8b\u52bf<\/th>\n<th style=\"text-align: center;\">\u8bbe\u8ba1\u51fd\u6570<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">Linear<\/td>\n<td style=\"text-align: center;\">Constant<\/td>\n<td style=\"text-align: center;\">?(?)=?f(x)=x<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Early Pause<\/td>\n<td style=\"text-align: center;\">Speeds up<\/td>\n<td style=\"text-align: center;\">?(?)=?+(1\u2212???(?\u2217\u03c0\u22172+\u03c0\/2)\/\u22128f(x)=x+(1\u2212sin(x\u2217\u03c0\u22172+\u03c0\/2)\/\u22128<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Late Pause<\/td>\n<td style=\"text-align: center;\">Slows down<\/td>\n<td style=\"text-align: center;\">?(?)=?+(1\u2212???(?\u2217\u03c0\u22172+\u03c0\/2)\/8f(x)=x+(1\u2212sin(x\u2217\u03c0\u22172+\u03c0\/2)\/8<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Slow Wavy<\/td>\n<td style=\"text-align: center;\">Constant<\/td>\n<td style=\"text-align: center;\">?(?)=?+(1\u2212???(?\u2217\u03c0\u22172+\u03c0\/2)\/8f(x)=x+(1\u2212sin(x\u2217\u03c0\u22172+\u03c0\/2)\/8<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Fast Wavy<\/td>\n<td style=\"text-align: center;\">Constant<\/td>\n<td style=\"text-align: center;\">?(?)=?+(1\u2212???(?\u2217\u03c0\u22172+\u03c0\/2)\/8f(x)=x+(1\u2212sin(x\u2217\u03c0\u22172+\u03c0\/2)\/8<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Power<\/td>\n<td style=\"text-align: center;\">Speeds up<\/td>\n<td style=\"text-align: center;\">?(?)=(?+(1\u2212?)\u22170.03)2f(x)=(x+(1\u2212x)\u22170.03)2<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Inverse Power<\/td>\n<td style=\"text-align: center;\">Slows down<\/td>\n<td style=\"text-align: center;\">?(?)=1+(1\u2212?)1.5\u2217\u22121f(x)=1+(1\u2212x)1.5\u2217\u22121<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Fast Power<\/td>\n<td style=\"text-align: center;\">Speeds up<\/td>\n<td style=\"text-align: center;\">?(?)=(?+(1\u2212?)\/2)8f(x)=(x+(1\u2212x)\/2)8<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Inverse Fast Power<\/td>\n<td style=\"text-align: center;\">Slows down<\/td>\n<td style=\"text-align: center;\">?(?)=1+(1\u2212?)3\u2217\u22121<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001&quot;\u6587\u672c\u8fdb\u5ea6\u6761&quot;\u95ee\u9898\u5206\u6790 1.1 \u6587\u672c\u8fdb\u5ea6\u6761 \u7528\u8fc7\u8ba1\u7b97\u673a\u7684\u90fd\u89c1\u8fc7 \u8fdb\u5ea6\u6761\u4ec0\u4e48\u539f\u7406\u5462\uff1f 1 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":5477,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[371,374],"tags":[],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/5475"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5475"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/5475\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/media\/5477"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5475"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}