{"id":973975,"date":"2024-12-27T06:01:16","date_gmt":"2024-12-26T22:01:16","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/973975.html"},"modified":"2024-12-27T06:01:18","modified_gmt":"2024-12-26T22:01:18","slug":"python%e5%a6%82%e4%bd%95%e6%b7%bb%e5%8a%a0tqdm%e5%ba%93","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/973975.html","title":{"rendered":"python\u5982\u4f55\u6dfb\u52a0tqdm\u5e93"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24195915\/b6783576-4d64-4205-b358-14cc1c6d4a73.webp\" alt=\"python\u5982\u4f55\u6dfb\u52a0tqdm\u5e93\" \/><\/p>\n<p><p> <strong>\u8981\u5728Python\u4e2d\u6dfb\u52a0<code>tqdm<\/code>\u5e93\uff0c\u60a8\u9700\u8981\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u5982<code>pip<\/code>\uff0c\u901a\u8fc7\u547d\u4ee4\u884c\u6267\u884c\u5b89\u88c5\u3001\u786e\u4fddPython\u73af\u5883\u5df2\u7ecf\u6b63\u786e\u914d\u7f6e\u3001\u5b89\u88c5\u540e\u53ef\u4ee5\u5bfc\u5165\u5e76\u4f7f\u7528<code>tqdm<\/code>\u5e93\u3002<\/strong> \u5176\u4e2d\u6700\u5e38\u7528\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<code>pip<\/code>\u5de5\u5177\uff0c\u901a\u8fc7\u547d\u4ee4\u884c\u8f93\u5165<code>pip install tqdm<\/code>\u6765\u5b89\u88c5<code>tqdm<\/code>\u5e93\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u63cf\u8ff0\u5982\u4f55\u6b63\u786e\u5b89\u88c5\u548c\u4f7f\u7528<code>tqdm<\/code>\u5e93\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u5b89\u88c5TQDM\u5e93<\/p>\n<\/p>\n<p><p>\u5b89\u88c5<code>tqdm<\/code>\u5e93\u662f\u4e00\u4e2a\u975e\u5e38\u7b80\u5355\u7684\u8fc7\u7a0b\uff0c\u53ea\u9700\u5728\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u4e2d\u6267\u884c\u4e00\u6761\u547d\u4ee4\u5373\u53ef\u3002\u786e\u4fdd\u5728\u6b64\u4e4b\u524d\uff0c\u60a8\u7684\u7cfb\u7edf\u5df2\u7ecf\u6b63\u786e\u5b89\u88c5\u4e86Python\u4ee5\u53ca<code>pip<\/code>\u5305\u7ba1\u7406\u5de5\u5177\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u67e5Python\u548cPIP<\/strong>\uff1a\u5728\u5b89\u88c5<code>tqdm<\/code>\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u60a8\u7684\u8ba1\u7b97\u673a\u4e0a\u5df2\u5b89\u88c5\u4e86Python\u548c<code>pip<\/code>\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p>pip --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u663e\u793a\u60a8\u5f53\u524d\u5b89\u88c5\u7684Python\u548c<code>pip<\/code>\u7248\u672c\u3002\u5982\u679c\u672a\u5b89\u88c5\uff0c\u8bf7\u5148\u4e0b\u8f7d\u5e76\u5b89\u88c5Python\uff0c<code>pip<\/code>\u901a\u5e38\u4f1a\u968fPython\u4e00\u8d77\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5TQDM<\/strong>\uff1a\u786e\u4fddPython\u548c<code>pip<\/code>\u6b63\u5e38\u5de5\u4f5c\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5<code>tqdm<\/code>\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install tqdm<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u4ecePython\u7684\u5b98\u65b9\u5305\u5e93PyPI\u4e2d\u4e0b\u8f7d\u5e76\u5b89\u88c5<code>tqdm<\/code>\u5230\u60a8\u7684Python\u73af\u5883\u4e2d\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fPython 3\uff0c\u53ef\u80fd\u9700\u8981\u4f7f\u7528<code>pip3 install tqdm<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong>\uff1a\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1<code>tqdm<\/code>\u662f\u5426\u5b89\u88c5\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -c &quot;import tqdm&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u6ca1\u6709\u9519\u8bef\u6d88\u606f\uff0c\u5219\u8868\u793a<code>tqdm<\/code>\u5df2\u6210\u529f\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u4f7f\u7528TQDM\u5e93<\/p>\n<\/p>\n<p><p>\u5b89\u88c5<code>tqdm<\/code>\u540e\uff0c\u60a8\u53ef\u4ee5\u5728Python\u811a\u672c\u6216\u4ea4\u4e92\u5f0f\u73af\u5883\u4e2d\u4f7f\u7528\u5b83\u6765\u663e\u793a\u8fdb\u5ea6\u6761\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u57fa\u672c\u7528\u6cd5<\/strong>\uff1a\u6700\u5e38\u89c1\u7684\u7528\u6cd5\u662f\u5728\u8fed\u4ee3\u8fc7\u7a0b\u4e2d\u663e\u793a\u8fdb\u5ea6\u6761\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528<code>tqdm<\/code>\u5305\u88c5\u4efb\u4f55\u53ef\u8fed\u4ee3\u5bf9\u8c61\uff0c\u4f8b\u5982\u5217\u8868\u6216\u751f\u6210\u5668\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from tqdm import tqdm<\/p>\n<p>import time<\/p>\n<p>for i in tqdm(range(100)):<\/p>\n<p>    time.sleep(0.1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4ee5\u4e0a\u4ee3\u7801\u5c06\u5728\u63a7\u5236\u53f0\u4e0a\u663e\u793a\u4e00\u4e2a\u8fdb\u5ea6\u6761\uff0c\u8868\u793a<code>for<\/code>\u5faa\u73af\u7684\u8fdb\u5ea6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9ad8\u7ea7\u7528\u6cd5<\/strong>\uff1a\u9664\u4e86\u57fa\u672c\u7684\u8fdb\u5ea6\u6761\uff0c<code>tqdm<\/code>\u8fd8\u652f\u6301\u5176\u4ed6\u9ad8\u7ea7\u529f\u80fd\uff0c\u4f8b\u5982\u5d4c\u5957\u8fdb\u5ea6\u6761\u3001\u591a\u7ebf\u7a0b\u652f\u6301\u548c\u81ea\u5b9a\u4e49\u6837\u5f0f\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u5d4c\u5957\u8fdb\u5ea6\u6761<\/strong>\uff1a\u5982\u679c\u60a8\u6709\u5d4c\u5957\u5faa\u73af\uff0c\u53ef\u4ee5\u4f7f\u7528<code>tqdm<\/code>\u7684<code>desc<\/code>\u53c2\u6570\u4e3a\u6bcf\u4e2a\u8fdb\u5ea6\u6761\u6dfb\u52a0\u63cf\u8ff0\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">for i in tqdm(range(3), desc=&#39;Outer Loop&#39;):<\/p>\n<p>    for j in tqdm(range(5), desc=&#39;Inner Loop&#39;):<\/p>\n<p>        time.sleep(0.1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u591a\u7ebf\u7a0b\u652f\u6301<\/strong>\uff1a\u5728\u591a\u7ebf\u7a0b\u6216\u591a\u8fdb\u7a0b\u73af\u5883\u4e2d\u4f7f\u7528<code>tqdm<\/code>\uff0c\u53ef\u4ee5\u786e\u4fdd\u8fdb\u5ea6\u6761\u7684\u6b63\u786e\u663e\u793a\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u81ea\u5b9a\u4e49\u6837\u5f0f<\/strong>\uff1a\u53ef\u4ee5\u901a\u8fc7\u53c2\u6570\u81ea\u5b9a\u4e49\u8fdb\u5ea6\u6761\u7684\u6837\u5f0f\uff0c\u4f8b\u5982\u989c\u8272\u3001\u683c\u5f0f\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9519\u8bef\u5904\u7406\u4e0e\u8c03\u8bd5<\/strong>\uff1a\u5728\u4f7f\u7528<code>tqdm<\/code>\u65f6\uff0c\u5982\u679c\u9047\u5230\u4efb\u4f55\u95ee\u9898\uff0c\u9996\u5148\u68c0\u67e5\u662f\u5426\u6709\u6700\u65b0\u7248\u672c\u7684<code>tqdm<\/code>\uff0c\u53ef\u4ee5\u901a\u8fc7<code>pip install --upgrade tqdm<\/code>\u6765\u66f4\u65b0\u3002\u5e76\u67e5\u770b\u5b98\u65b9\u6587\u6863\u548c\u793e\u533a\u652f\u6301\u4ee5\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001TQDM\u7684\u5e94\u7528\u573a\u666f<\/p>\n<\/p>\n<p><p><code>tqdm<\/code>\u5e93\u7684\u5f3a\u5927\u4e4b\u5904\u5728\u4e8e\u5176\u7075\u6d3b\u6027\u548c\u6613\u7528\u6027\uff0c\u80fd\u591f\u9002\u7528\u4e8e\u591a\u79cd\u573a\u666f\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6570\u636e\u5904\u7406<\/strong>\uff1a\u5728\u6570\u636e\u5904\u7406\u811a\u672c\u4e2d\u4f7f\u7528<code>tqdm<\/code>\u53ef\u4ee5\u5e2e\u52a9\u60a8\u8ddf\u8e2a\u5904\u7406\u8fdb\u5ea6\uff0c\u7279\u522b\u662f\u5728\u5904\u7406\u5927\u6570\u636e\u96c6\u65f6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8bad\u7ec3\u6a21\u578b<\/strong>\uff1a\u5728<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\uff0c\u4f7f\u7528<code>tqdm<\/code>\u53ef\u4ee5\u5b9e\u65f6\u663e\u793a\u8bad\u7ec3\u8fdb\u5ea6\uff0c\u5e2e\u52a9\u60a8\u66f4\u597d\u5730\u7ba1\u7406\u548c\u76d1\u63a7\u8bad\u7ec3\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6587\u4ef6\u64cd\u4f5c<\/strong>\uff1a\u5728\u6587\u4ef6\u4e0b\u8f7d\u6216\u4e0a\u4f20\u811a\u672c\u4e2d\u4f7f\u7528<code>tqdm<\/code>\uff0c\u53ef\u4ee5\u8ba9\u7528\u6237\u4e86\u89e3\u5f53\u524d\u64cd\u4f5c\u7684\u8fdb\u5ea6\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001TQDM\u7684\u6027\u80fd\u4f18\u5316<\/p>\n<\/p>\n<p><p>\u867d\u7136<code>tqdm<\/code>\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u5e93\uff0c\u4f46\u5728\u5904\u7406\u975e\u5e38\u5927\u91cf\u7684\u6570\u636e\u65f6\uff0c\u663e\u793a\u8fdb\u5ea6\u6761\u53ef\u80fd\u4f1a\u5e26\u6765\u4e00\u4e9b\u6027\u80fd\u5f00\u9500\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4f18\u5316\u5efa\u8bae\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u51cf\u5c11\u5237\u65b0\u9891\u7387<\/strong>\uff1a\u901a\u8fc7\u8bbe\u7f6e<code>mininterval<\/code>\u53c2\u6570\uff0c\u51cf\u5c11\u8fdb\u5ea6\u6761\u7684\u5237\u65b0\u9891\u7387\uff0c\u4ece\u800c\u964d\u4f4e\u6027\u80fd\u5f00\u9500\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6279\u91cf\u66f4\u65b0<\/strong>\uff1a\u5728\u5927\u91cf\u8fed\u4ee3\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>tqdm.update(n)<\/code>\u6279\u91cf\u66f4\u65b0\u8fdb\u5ea6\u6761\uff0c\u800c\u4e0d\u662f\u6bcf\u6b21\u8fed\u4ee3\u90fd\u66f4\u65b0\u4e00\u6b21\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5f02\u6b65\u5904\u7406<\/strong>\uff1a\u5728\u5f02\u6b65\u73af\u5883\u4e2d\u4f7f\u7528<code>tqdm.asyncio<\/code>\u53ef\u4ee5\u63d0\u9ad8\u6027\u80fd\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001TQDM\u7684\u6269\u5c55\u4e0e\u96c6\u6210<\/p>\n<\/p>\n<p><p><code>tqdm<\/code>\u4e0d\u4ec5\u63d0\u4f9b\u4e86\u57fa\u672c\u7684\u8fdb\u5ea6\u6761\u529f\u80fd\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u6269\u5c55\u4e0e\u5176\u4ed6\u5e93\u96c6\u6210\uff0c\u589e\u5f3a\u5176\u5b9e\u7528\u6027\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4e0ePandas\u96c6\u6210<\/strong>\uff1a\u901a\u8fc7<code>tqdm.pandas()<\/code>\uff0c\u53ef\u4ee5\u5728Pandas\u7684<code>apply<\/code>\u64cd\u4f5c\u4e2d\u4f7f\u7528\u8fdb\u5ea6\u6761\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>from tqdm import tqdm<\/p>\n<p>tqdm.pandas(desc=&quot;Processing&quot;)<\/p>\n<p>df = pd.DataFrame(range(1000))<\/p>\n<p>df.progress_apply(lambda x: x2)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4e0e\u5176\u4ed6\u5e93\u96c6\u6210<\/strong>\uff1a<code>tqdm<\/code>\u53ef\u4ee5\u4e0e\u8bb8\u591a\u5176\u4ed6\u5e93\u96c6\u6210\uff0c\u4f8b\u5982<code>Keras<\/code>\u3001<code>PyTorch<\/code>\u7b49\uff0c\u5e2e\u52a9\u76d1\u63a7\u8bad\u7ec3\u8fdb\u5ea6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u63d2\u4ef6\u4e0e\u6269\u5c55<\/strong>\uff1a\u53ef\u4ee5\u5f00\u53d1\u81ea\u5b9a\u4e49\u63d2\u4ef6\u6216\u4f7f\u7528\u793e\u533a\u63d0\u4f9b\u7684\u6269\u5c55\uff0c\u4ee5\u6ee1\u8db3\u7279\u5b9a\u9700\u6c42\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u603b\u7ed3\u4e0e\u5e38\u89c1\u95ee\u9898<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u4ecb\u7ecd\uff0c\u76f8\u4fe1\u60a8\u5df2\u7ecf\u5bf9\u5982\u4f55\u5728Python\u4e2d\u5b89\u88c5\u548c\u4f7f\u7528<code>tqdm<\/code>\u5e93\u6709\u4e86\u6df1\u5165\u7684\u4e86\u89e3\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u5b89\u88c5\u5931\u8d25<\/strong>\uff1a\u5982\u679c\u5728\u5b89\u88c5<code>tqdm<\/code>\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5\u548cPython\u73af\u5883\uff0c\u5e76\u5c1d\u8bd5\u4f7f\u7528<code>pip install --upgrade pip<\/code>\u66f4\u65b0<code>pip<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fdb\u5ea6\u6761\u4e0d\u663e\u793a<\/strong>\uff1a\u5728\u67d0\u4e9bIDE\u6216\u73af\u5883\u4e2d\uff0c\u8fdb\u5ea6\u6761\u53ef\u80fd\u4e0d\u663e\u793a\u3002\u53ef\u4ee5\u5c1d\u8bd5\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u811a\u672c\uff0c\u6216\u8005\u68c0\u67e5<code>tqdm<\/code>\u7684\u8bbe\u7f6e\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6027\u80fd\u95ee\u9898<\/strong>\uff1a\u5982\u679c<code>tqdm<\/code>\u5f71\u54cd\u4e86\u7a0b\u5e8f\u6027\u80fd\uff0c\u53ef\u4ee5\u53c2\u8003\u6027\u80fd\u4f18\u5316\u90e8\u5206\u7684\u5efa\u8bae\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u603b\u4e4b\uff0c<code>tqdm<\/code>\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u4e14\u6613\u4e8e\u4f7f\u7528\u7684\u8fdb\u5ea6\u6761\u5e93\uff0c\u80fd\u591f\u5e2e\u52a9\u5f00\u53d1\u8005\u66f4\u597d\u5730\u7ba1\u7406\u548c\u76d1\u63a7\u7a0b\u5e8f\u6267\u884c\u8fdb\u5ea6\u3002\u5728\u4e0d\u540c\u7684\u5e94\u7528\u573a\u666f\u4e2d\uff0c\u5408\u7406\u4f7f\u7528<code>tqdm<\/code>\u53ef\u4ee5\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\u548c\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u9879\u76ee\u4e2d\u5b89\u88c5tqdm\u5e93\uff1f<\/strong><br \/>\u8981\u5728Python\u9879\u76ee\u4e2d\u5b89\u88c5tqdm\u5e93\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Python\u5305\u7ba1\u7406\u5de5\u5177pip\u3002\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<code>pip install tqdm<\/code>\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fAnaconda\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7<code>conda install tqdm<\/code>\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u901a\u8fc7<code>import tqdm<\/code>\u6765\u5f15\u7528\u8be5\u5e93\u3002<\/p>\n<p><strong>tqdm\u5e93\u7684\u4e3b\u8981\u529f\u80fd\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>tqdm\u5e93\u7684\u4e3b\u8981\u529f\u80fd\u662f\u4e3aPython\u4e2d\u7684\u5faa\u73af\u63d0\u4f9b\u8fdb\u5ea6\u6761\u663e\u793a\u3002\u65e0\u8bba\u662f\u6587\u4ef6\u5904\u7406\u3001\u6570\u636e\u52a0\u8f7d\u8fd8\u662f\u5176\u4ed6\u9700\u8981\u5faa\u73af\u5904\u7406\u7684\u4efb\u52a1\uff0ctqdm\u90fd\u53ef\u4ee5\u5e2e\u52a9\u60a8\u5b9e\u65f6\u4e86\u89e3\u4efb\u52a1\u7684\u8fdb\u5ea6\u3002\u8fd9\u5bf9\u4e8e\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u7a0b\u5e8f\u5c24\u5176\u6709\u5e2e\u52a9\uff0c\u80fd\u591f\u4f7f\u7528\u6237\u76f4\u89c2\u5730\u770b\u5230\u8fdb\u5ea6\uff0c\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528tqdm\u5e93\u663e\u793a\u8fdb\u5ea6\u6761\uff1f<\/strong><br \/>\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528tqdm\u5e93\u975e\u5e38\u7b80\u5355\u3002\u60a8\u53ea\u9700\u5c06\u9700\u8981\u76d1\u63a7\u8fdb\u5ea6\u7684\u53ef\u8fed\u4ee3\u5bf9\u8c61\u5305\u88c5\u5728<code>tqdm()<\/code>\u51fd\u6570\u4e2d\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u6b63\u5728\u5904\u7406\u4e00\u4e2a\u5217\u8868\uff0c\u53ef\u4ee5\u8fd9\u6837\u5199\uff1a<code>for item in tqdm(my_list):<\/code>\u3002\u8fd9\u4f1a\u5728\u63a7\u5236\u53f0\u4e2d\u663e\u793a\u8fdb\u5ea6\u6761\uff0c\u60a8\u8fd8\u53ef\u4ee5\u81ea\u5b9a\u4e49\u8fdb\u5ea6\u6761\u7684\u63cf\u8ff0\u4fe1\u606f\u548c\u6837\u5f0f\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u6ee1\u8db3\u60a8\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5728Python\u4e2d\u6dfb\u52a0tqdm\u5e93\uff0c\u60a8\u9700\u8981\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u5982pip\uff0c\u901a\u8fc7\u547d\u4ee4\u884c\u6267\u884c\u5b89\u88c5\u3001\u786e\u4fddPython\u73af\u5883\u5df2\u7ecf [&hellip;]","protected":false},"author":3,"featured_media":973976,"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\/973975"}],"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=973975"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/973975\/revisions"}],"predecessor-version":[{"id":973977,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/973975\/revisions\/973977"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/973976"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=973975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=973975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=973975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}