{"@attributes":{"version":"2.0"},"channel":{"title":"Python \u7a0b\u5f0f\u8a2d\u8a08 - \u521d\u968e on","link":"https:\/\/myapollo.com.tw\/categories\/python-%E7%A8%8B%E5%BC%8F%E8%A8%AD%E8%A8%88-%E5%88%9D%E9%9A%8E\/","description":"Recent content in Python \u7a0b\u5f0f\u8a2d\u8a08 - \u521d\u968e on","generator":"Hugo -- gohugo.io","lastBuildDate":"Wed, 09 Apr 2025 00:06:41 +0800","item":[{"title":"\u4f60\u53ef\u80fd\u5ffd\u7565\u7684 Python \u529f\u80fd\uff1aEllipsis (...)","link":"https:\/\/myapollo.com.tw\/blog\/python-ellipsis\/","pubDate":"Wed, 09 Apr 2025 00:06:41 +0800","guid":"https:\/\/myapollo.com.tw\/blog\/python-ellipsis\/","description":"\u5373\u4f7f\u5beb\u4e86 Python \u5982\u6b64\u591a\u5e74\uff0c\u6211\u4ecd\u672a\u767c\u89ba ... \uff08\u4f60\u6c92\u770b\u932f\uff0c\u4e09\u500b\u9ede\uff09\u5728 Python \u4e5f\u662f\u4e00\u500b object\uff0c\u800c\u4e14\u5b83\u6709\u4e9b\u4e0d\u70ba\u4eba\u77e5\u7684\u5999\u7528\uff0c\u53ef\u4ee5\u63d0\u6607\u7a0b\u5f0f\u78bc\u7684\u7c21\u6f54\u6027\u6216\u53ef\u8b80\u6027\uff0c\u5982\u679c"},{"title":"\u7528 Python \u5b78\u8499\u5730\u5361\u7f85\u65b9\u6cd5\/\u6a21\u64ec","link":"https:\/\/myapollo.com.tw\/blog\/python-monte-carlo-method\/","pubDate":"Mon, 09 Sep 2024 23:34:31 +0800","guid":"https:\/\/myapollo.com.tw\/blog\/python-monte-carlo-method\/","description":"<p>\u5982\u679c\u8aaa\u6709\u4e00\u7a2e\u65b9\u6cd5\u80fd\u50cf\u5947\u7570\u535a\u58eb\u90a3\u6a23\u770b\u5230 14,000,605 \u7a2e\u672a\u4f86\uff0c\u90a3\u5927\u6982\u5c31\u662f\u8499\u5730\u5361\u7f85\u65b9\u6cd5\u4e86\u3002<\/p>\n<p>\u5728\u63a5\u89f8\u8499\u5730\u5361\u7f85\u65b9\u6cd5\u4e4b\u524d\uff0c\u6211\u66fe\u4ee5\u70ba\u5b83\u662f\u4e00\u7a2e\u795e\u5947\u7684\u6f14\u7b97\u6cd5\u3002\u4f46\u6df1\u5165\u4e86\u89e3\u5f8c\u624d\u767c\u73fe\uff0c\u8499\u5730\u5361\u7f85\u65b9\u6cd5\u5176\u5be6\u662f\u4e00\u7a2e\u7c21\u55ae\u3001\u76f4\u89c0\u4e14\u5be6\u7528\u7684\u5de5\u5177\uff01<\/p>\n<p>\u672c\u6587\u5c07\u4ecb\u7d39\u8499\u5730\u5361\u7f85\u65b9\u6cd5\uff0c\u4e26\u4f7f\u7528 Python \u9032\u884c\u5be6\u969b\u6f14\u7df4\uff0c\u5f9e\u8a08\u7b97 \u03c0 \u503c\u5230\u6a21\u64ec\u53f0\u80a1\u7684\u9577\u671f\u6295\u8cc7\uff0c\u5e6b\u52a9\u5927\u5bb6\u5f9e\u7406\u8ad6\u5230\u5be6\u52d9\u5168\u9762\u638c\u63e1\uff01<\/p>"},{"title":"\u7528 Python \u5be6\u4f5c Floyd-Warshall \u6f14\u7b97\u6cd5\uff1a\u5f9e\u6700\u77ed\u8def\u5f91\u5230\u5c0b\u627e\u6700\u4fbf\u5b9c\u6a5f\u7968","link":"https:\/\/myapollo.com.tw\/blog\/floyd-warshall-algorithm\/","pubDate":"Fri, 16 Aug 2024 15:26:33 +0800","guid":"https:\/\/myapollo.com.tw\/blog\/floyd-warshall-algorithm\/","description":"<p>Floyd-Warshall \u6f14\u7b97\u6cd5\uff0c\u53c8\u7a31\u4f5b\u6d1b\u4f0a\u5fb7\u6f14\u7b97\u6cd5\uff0c\u4e3b\u8981\u7528\u65bc\u627e\u51fa\u5716(graph)\u4e2d\u6240\u6709\u9802\u9ede\u4e4b\u9593\u7684\u6700\u77ed\u8def\u5f91\uff0c\u5b83\u4e5f\u80fd\u7528\u4f86\u5075\u6e2c\u5716\u4e2d\u662f\u5426\u5b58\u5728\u9589\u74b0(cycle)\u3002<\/p>\n<p>\u672c\u6587\u5c07\u4f7f\u7528 Python \u5b78\u7fd2 Floyd-Warshall \u6f14\u7b97\u6cd5\uff0c\u4e26\u4e14\u4ee5\u627e\u51fa\u57ce\u5e02\u8207\u57ce\u5e02\u4e4b\u9593\u6700\u4fbf\u5b9c\u6a5f\u7968\u7d44\u5408\u4f5c\u70ba\u61c9\u7528\u7bc4\u4f8b\uff0c\u8b93\u8b80\u8005\u5c0d Floyd-Warshall \u6f14\u7b97\u6cd5\u6709\u6df1\u5165\u7684\u4e86\u89e3\u3002<\/p>"},{"title":"\u5f9e Python \u7684 random.shuffle() \u5b78 Fisher-Yates Shuffle \/ Knuth Shuffle \u6f14\u7b97\u6cd5","link":"https:\/\/myapollo.com.tw\/blog\/python-random-shuffle-research\/","pubDate":"Thu, 04 Jul 2024 11:51:59 +0800","guid":"https:\/\/myapollo.com.tw\/blog\/python-random-shuffle-research\/","description":"<p>\u6700\u8fd1\u63a5\u89f8\u4e86\u4e00\u4e9b\u724c\u985e\u904a\u6232\u7684\u958b\u767c\uff0c\u767c\u73fe\u5982\u4f55\u6d17\u724c\u4e5f\u662f 1 \u500b\u5b78\u554f\uff0c\u6240\u4ee5\u7279\u5225\u67e5\u4e86\u4e00\u500b\u91cd\u8981\u7684\u6f14\u7b97\u6cd5 Fisher-Yates Shuffle \/ Knuth Shuffle \uff0c\u767c\u73fe Python \u7684 <a href=\"https:\/\/docs.python.org\/3\/library\/random.html#random.shuffle\">random.shuffle()<\/a> \u4e5f\u4f7f\u7528\u76f8\u540c\u7684\u6f14\u7b97\u6cd5\u5be6\u4f5c\uff0c\u6240\u4ee5\u7279\u5225\u5c07 Fisher-Yates Shuffle \/ Knuth Shuffle \u5be6\u4f5c\u7d30\u7bc0\u8207\u8996\u89ba\u5316\u505a\u51fa\u4f86\uff0c\u5e0c\u671b\u53ef\u4ee5\u8b93\u4e0d\u719f\u6089\u7684\u4eba\u4e5f\u80fd\u8fc5\u901f\u4e0a\u624b\u3002<\/p>"},{"title":"Python \u521d\u5b78\u8005\u5e38\u72af\u932f\u8aa4 \u2014 \u6b63\u898f\u8868\u793a\u5f0f\u672a\u6b63\u78ba\u4f7f\u7528 re.compile()","link":"https:\/\/myapollo.com.tw\/blog\/python-common-mistake-re-compile\/","pubDate":"Tue, 02 Jul 2024 11:16:48 +0800","guid":"https:\/\/myapollo.com.tw\/blog\/python-common-mistake-re-compile\/","description":"\u773e\u6240\u7686\u77e5\uff0c Python \u4e0d\u662f\u4e00\u500b\u4ee5\u6548\u80fd\u8457\u7a31\u7684\u8a9e\u8a00\uff0c\u6240\u4ee5\u66f4\u7279\u5225\u9700\u8981\u6ce8\u610f\u4e00\u4e9b\u6703\u8b93\u7a0b\u5f0f\u8b8a\u6162\u7684\u932f\u8aa4\u3002 \u672c\u6587\u5c07\u4ecb\u7d39\u521d\u5b78\u8005\u5e38\u72af\u7684\u932f\u8aa4\u300c\u4f7f\u7528\u6b63\u898f\u8868\u793a\u5f0f\u6642\uff0c\u672a\u6b63\u78ba\u4f7f\u7528 re.compile() \u300d"},{"title":"Python \u597d\u7528\u5957\u4ef6\u4ecb\u7d39 - structlog","link":"https:\/\/myapollo.com.tw\/blog\/python-structlog\/","pubDate":"Wed, 30 Aug 2023 16:17:15 +0800","guid":"https:\/\/myapollo.com.tw\/blog\/python-structlog\/","description":"<p>\u5927\u5bb6\u521d\u6b21\u4f7f\u7528 Python \u7684 <a href=\"https:\/\/docs.python.org\/3\/library\/logging.html\">logging<\/a> \u6a21\u7d44\u6642\uff0c\u61c9\u8a72\u90fd\u8ddf\u6211\u540c\u6a23\u56f0\u60d1\u904e\uff0c\u4f8b\u5982\u4e0b\u5217\u7a0b\u5f0f\u78bc\uff1a<\/p>\n<pre><code>import logging\nlog = logging.getLogger(__name__)\nlog.info('Hello')\n<\/code><\/pre>\n<p>\u6211\u5011\u6703\u9810\u671f\u4e0a\u8ff0\u7a0b\u5f0f\u78bc\u8981\u5217\u5370 <code>Hello<\/code> \u7684\u5b57\u4e32\uff0c\u7136\u800c\u4e8b\u5be6\u662f\u4e0d\u6703\u3002<\/p>\n<p>\u9019\u662f\u7531\u65bc Python logging \u6a21\u7d44\u9810\u8a2d\u7684 log level \u70ba <code>WARNING<\/code> , \u6240\u4ee5\u53ea\u6709 <code>WARNING<\/code> , <code>ERROR<\/code> \u4ee5\u53ca <code>CRITICAL<\/code> \u624d\u6703\u986f\u793a\u3002<\/p>\n<p>\u6240\u4ee5\u4f7f\u7528 <a href=\"https:\/\/docs.python.org\/3\/library\/logging.html\">logging<\/a> \u6a21\u7d44\u901a\u5e38\u90fd\u8981\u984d\u5916\u505a\u4e00\u4e9b\u8a2d\u5b9a\u624d\u884c\uff0c\u9019\u4e0d\u514d\u9700\u8981\u8b80\u4e00\u4e0b Python \u5b98\u65b9\u6587\u4ef6\u3002\uff08\u9019\u4e0d\u662f Python \u7684\u554f\u984c\uff0c\u53ea\u662f\u8a2d\u8a08\u54f2\u5b78\u4e0d\u540c\uff09<\/p>\n<p>\u90a3\u9ebc\uff0c\u6709\u6c92\u6709\u4ec0\u9ebc\u5957\u4ef6\u6bd4\u8d77\u5167\u5efa\u7684 <a href=\"https:\/\/docs.python.org\/3\/library\/logging.html\">logging<\/a> \u6a21\u7d44\u66f4\u76f4\u89ba\u597d\u7528\u5462\uff1f<\/p>\n<p>\u7b54\u6848\u662f\u300c\u6709\u300d\uff0c\u90a3\u5c31\u662f\u672c\u6587\u8981\u4ecb\u7d39\u7684 <a href=\"https:\/\/www.structlog.org\/en\/stable\/index.html\">structlog<\/a> \u5957\u4ef6\u3002<\/p>"},{"title":"Python \u597d\u7528\u5957\u4ef6\u4ecb\u7d39 - better-exceptions","link":"https:\/\/myapollo.com.tw\/blog\/python-better-exceptions\/","pubDate":"Fri, 25 Aug 2023 11:01:40 +0800","guid":"https:\/\/myapollo.com.tw\/blog\/python-better-exceptions\/","description":"<p>\u76f8\u4fe1\u5927\u5bb6\u5b78\u5beb\u7a0b\u5f0f\u90fd\u6709\u76f8\u540c\u7684\u4e00\u6bb5\u7d93\u9a57\uff0c\u90a3\u5c31\u662f\u770b\u4e0d\u61c2\u4f8b\u5916\u932f\u8aa4(exceptions)\u8a0a\u606f\u7684\u610f\u601d\uff0c\u4f60\u53ef\u80fd\u6bcf\u500b\u55ae\u5b57\u90fd\u8a8d\u8b58\uff0c\u4f46\u7d44\u5408\u8d77\u4f86\u5c31\u50cf\u5929\u66f8\u4e00\u6a23\u96e3\u4ee5\u7406\u89e3\u22ef\u22ef\u3002<\/p>\n<p>\u5982\u679c\u6709\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u4f8b\u5916\u932f\u8aa4\u8a0a\u606f\u7684\u8a71\uff0c\u76f8\u4fe1\u6703\u6e1b\u8f15\u5927\u5bb6\u5728\u5b78\u7fd2\u8207\u9664\u932f\u7684\u75db\u9ede\uff01<\/p>\n<p>\u672c\u6587\u8981\u4ecb\u7d39\u7684 <a href=\"https:\/\/github.com\/qix-\/better-exceptions\">better-exceptions<\/a> \u5957\u4ef6\uff0c\u662f\u4e00\u500b\u4e0d\u7ba1\u65b0\u624b\u3001\u8001\u624b\u90fd\u9069\u7528\u7684\u5957\u4ef6\uff0c\u5b83\u6539\u826f\u4e86 Python \u7684\u4f8b\u5916\u932f\u8aa4\u8a0a\u606f\uff0c\u628a\u932f\u8aa4\u7576\u4e0b\u7684\u8b8a\u6578\u503c\u4e00\u4f75\u986f\u793a\u5728\u4f8b\u5916\u932f\u8aa4\u8a0a\u606f\u7576\u4e2d\uff0c\u5c31\u9019\u4e00\u500b\u8cbc\u5fc3\u7684\u8209\u52d5\uff0c\u5927\u5927\u6539\u5584\u5927\u5bb6\u5728\u5b78\u7fd2\u8207\u9664\u932f\u7684\u9ad4\u9a57\u3002<\/p>\n<p>\u662f\u4e00\u500b\u503c\u5f97\u63a8\u85a6\u8207\u64c1\u6709\u7684\u5957\u4ef6\uff01<\/p>"},{"title":"\u5236\u9738 Python f-string \u5404\u7a2e\u683c\u5f0f\u4f7f\u7528\u65b9\u6cd5","link":"https:\/\/myapollo.com.tw\/blog\/python-f-string-formating-syntax\/","pubDate":"Mon, 31 Jul 2023 23:25:11 +0800","guid":"https:\/\/myapollo.com.tw\/blog\/python-f-string-formating-syntax\/","description":"<p>\u958b\u767c\u7a0b\u5f0f\u6642\uff0c\u5b57\u4e32\u7684\u8f38\u51fa\u7d93\u5e38\u6703\u9700\u8981\u505a\u4e00\u4e9b\u683c\u5f0f(format)\uff0c\u4f8b\u5982\u6578\u5b57\u52a0\u4e0a\u5343\u5206\u4f4d\u7b26\u865f\u3001\u767e\u5206\u6bd4\uff0c\u53c8\u6216\u8005\u9700\u8981\u7f6e\u5de6\u3001\u7f6e\u4e2d\u3001\u7f6e\u53f3\u5c0d\u9f4a\u7b49\u7b49\uff0c\u9019\u4e9b\u9700\u6c42 Python \u4e5f\u90fd\u6709\u7167\u9867\u5230\uff0c\u672c\u6587\u5c07\u4ecb\u7d39 Python \u5982\u4f55\u505a\u5b57\u4e32\u7684\u683c\u5f0f\u5316\u4ee5\u53ca\u5404\u7a2e\u7bc4\u4f8b\uff0c\u8b93\u5927\u5bb6\u90fd\u80fd\u5920\u8f15\u9b06\u5b8c\u6210\u5b57\u4e32\u7684\u683c\u5f0f\u5316\uff01<\/p>"},{"title":"Python \u55ae\u96d9\u661f\u865f(* & **)\u89e3\u8aaa","link":"https:\/\/myapollo.com.tw\/blog\/python-asterisk-symbols\/","pubDate":"Mon, 19 Sep 2022 22:29:33 +0800","guid":"https:\/\/myapollo.com.tw\/blog\/python-asterisk-symbols\/","description":"<p>Python \u5167\u5c07\u51fd\u6578\u7684\u53c3\u6578\u5206\u70ba keyword argument \u4ee5\u53ca positional argument, \u9019 2 \u8005\u7684\u5dee\u7570\u5728\u5b98\u65b9\u6587\u4ef6\u4e2d\u6709\u6e05\u695a\u8aaa\u660e\uff0c\u540c\u6642\u9019 2 \u7a2e\u5206\u5225\u652f\u63f4\u55ae\u661f\u865f <code>*<\/code> \u8207\u96d9\u661f\u865f <code>**<\/code> \u7684\u7528\u6cd5\uff0c\u662f Python \u958b\u767c\u8005\u4e00\u5b9a\u8981\u719f\u77e5\u7684\u7528\u6cd5\u3002<\/p>\n<p>\u672c\u6587\u5c07\u8a73\u7d30\u4ecb\u7d39\u8aaa\u660e\u3002<\/p>"},{"title":"\u70ba\u8a08\u6578\u800c\u751f - Python Counter \u985e\u5225","link":"https:\/\/myapollo.com.tw\/blog\/python-counter\/","pubDate":"Tue, 19 Apr 2022 23:45:42 +0800","guid":"https:\/\/myapollo.com.tw\/blog\/python-counter\/","description":"<p>Python <a href=\"https:\/\/docs.python.org\/3\/library\/collections.html\">collections<\/a> \u6a21\u7d44\u63d0\u4f9b\u591a\u500b\u65b9\u4fbf\u7684\u985e\u5225(class)\u4f9b\u958b\u767c\u8005\u5229\u7528\uff0c\u5176\u4e2d <a href=\"https:\/\/docs.python.org\/3\/library\/collections.html#collections.Counter\">Counter<\/a> \u985e\u5225\uff08<a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#dict\">dict<\/a> \u7684\u5b50\u985e\u5225\uff09\u53ef\u4ee5\u61c9\u7528\u5728\u8a08\u6578(counting)\u76f8\u95dc\u7684\u5834\u666f\uff1a<\/p>\n<blockquote>\n<p>A <a href=\"https:\/\/docs.python.org\/3\/library\/collections.html#collections.Counter\">Counter<\/a> is a <a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#dict\">dict<\/a> subclass for counting hashable objects.<\/p>\n<\/blockquote>\n<p>\u672c\u6587\u5c07\u4ecb\u7d39 <a href=\"https:\/\/docs.python.org\/3\/library\/collections.html#collections.Counter\">Counter<\/a> \u985e\u5225\u7684\u4f7f\u7528\u65b9\u5f0f\uff0c\u4e26\u6bd4\u8f03\u5176\u8207 <a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#dict\">dict<\/a> \u8207 <a href=\"https:\/\/docs.python.org\/3\/library\/collections.html#collections.defaultdict\">defaultdict<\/a> \u4e4b\u9593\u7684\u6548\u80fd\u5dee\u7570\u3002<\/p>"}]}}