{"id":2029,"date":"2026-04-20T14:29:50","date_gmt":"2026-04-20T06:29:50","guid":{"rendered":"http:\/\/www.preluna.xyz\/?p=2029"},"modified":"2026-04-20T14:29:53","modified_gmt":"2026-04-20T06:29:53","slug":"%e5%ad%97%e7%ac%a6%e4%b8%b2%e3%80%81%e5%88%97%e8%a1%a8%e3%80%81%e5%85%83%e7%bb%84%e8%bf%99%e4%b8%89%e4%b8%aa%e6%9c%80%e5%ae%b9%e6%98%93%e6%b7%b7%e6%b7%86%e7%9a%84%e5%9c%b0%e6%96%b9","status":"publish","type":"post","link":"http:\/\/www.preluna.xyz\/index.php\/2026\/04\/20\/%e5%ad%97%e7%ac%a6%e4%b8%b2%e3%80%81%e5%88%97%e8%a1%a8%e3%80%81%e5%85%83%e7%bb%84%e8%bf%99%e4%b8%89%e4%b8%aa%e6%9c%80%e5%ae%b9%e6%98%93%e6%b7%b7%e6%b7%86%e7%9a%84%e5%9c%b0%e6%96%b9\/preluna\/text\/","title":{"rendered":"\u5b57\u7b26\u4e32\u3001\u5217\u8868\u3001\u5143\u7ec4\u8fd9\u4e09\u4e2a\u6700\u5bb9\u6613\u6df7\u6dc6\u7684\u5730\u65b9"},"content":{"rendered":"\n<p>\u5728 Python \u5165\u95e8\u9636\u6bb5\uff0c<code>str<\/code> \u5b57\u7b26\u4e32\u3001<code>list<\/code> \u5217\u8868\u3001<code>tuple<\/code> \u5143\u7ec4\uff0c\u5e38\u5e38\u4f1a\u4e00\u8d77\u51fa\u73b0\u3002\u5b83\u4eec\u6709\u4e00\u4e2a\u5171\u540c\u70b9\uff1a<strong>\u90fd\u53ef\u4ee5\u6309\u987a\u5e8f\u5b58\u653e\u591a\u4e2a\u5185\u5bb9<\/strong>\u3002\u4e5f\u6b63\u56e0\u4e3a\u8fd9\u4e00\u70b9\uff0c\u521d\u5b66\u8005\u5f88\u5bb9\u6613\u628a\u5b83\u4eec\u6df7\u5728\u4e00\u8d77\uff0c\u89c9\u5f97\u201c\u770b\u8d77\u6765\u90fd\u5dee\u4e0d\u591a\u201d\u3002\u4f46\u771f\u6b63\u5199\u4ee3\u7801\u65f6\uff0c\u8fd9\u4e09\u8005\u7684\u7528\u9014\u3001\u5199\u6cd5\u548c\u80fd\u505a\u7684\u64cd\u4f5c\uff0c\u5176\u5b9e\u5e76\u4e0d\u5b8c\u5168\u4e00\u6837\u3002<\/p>\n\n\n\n<p>\u8fd9\u4e00\u8282\u5c31\u4e13\u95e8\u628a\u8fd9\u4e09\u4e2a\u6700\u5bb9\u6613\u6df7\u6dc6\u7684\u5730\u65b9\uff0c\u653e\u5728\u4e00\u8d77\u8bb2\u6e05\u695a\u3002\u4f60\u770b\u5b8c\u4ee5\u540e\uff0c\u81f3\u5c11\u8981\u80fd\u56de\u7b54\u4e0b\u9762\u51e0\u4e2a\u95ee\u9898\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b83\u4eec\u5230\u5e95\u5206\u522b\u662f\u5e72\u4ec0\u4e48\u7684<\/li>\n\n\n\n<li>\u5b83\u4eec\u4e3a\u4ec0\u4e48\u90fd\u80fd\u7528\u7d22\u5f15<\/li>\n\n\n\n<li>\u4e3a\u4ec0\u4e48\u6709\u7684\u80fd\u6539\uff0c\u6709\u7684\u4e0d\u80fd\u6539<\/li>\n\n\n\n<li>\u4e3a\u4ec0\u4e48\u6709\u7684\u7528\u65b9\u62ec\u53f7\uff0c\u6709\u7684\u7528\u5706\u62ec\u53f7<\/li>\n\n\n\n<li>\u5b9e\u9645\u5199\u4ee3\u7801\u65f6\uff0c\u4ec0\u4e48\u65f6\u5019\u8be5\u7528\u54ea\u4e00\u4e2a<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u5148\u7528\u4e00\u53e5\u8bdd\u533a\u5206\u5b83\u4eec<\/h2>\n\n\n\n<p>\u5148\u4e0d\u8981\u6025\u7740\u80cc\u5b9a\u4e49\uff0c\u53ef\u4ee5\u5148\u8bb0\u4f4f\u8fd9\u4e09\u4e2a\u6700\u76f4\u767d\u7684\u7406\u89e3\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5b57\u7b26\u4e32 <code>str<\/code><\/strong>\uff1a\u8868\u793a\u4e00\u6bb5\u6587\u672c<\/li>\n\n\n\n<li><strong>\u5217\u8868 <code>list<\/code><\/strong>\uff1a\u8868\u793a\u4e00\u7ec4\u53ef\u4ee5\u4fee\u6539\u7684\u6570\u636e<\/li>\n\n\n\n<li><strong>\u5143\u7ec4 <code>tuple<\/code><\/strong>\uff1a\u8868\u793a\u4e00\u7ec4\u4e0d\u60f3\u4fee\u6539\u7684\u6570\u636e<\/li>\n<\/ul>\n\n\n\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c\u5b83\u4eec\u90fd\u53ef\u4ee5\u88c5\u201c\u591a\u4e2a\u4e1c\u897f\u201d\uff0c\u4f46\u662f\u4f7f\u7528\u76ee\u7684\u4e0d\u540c\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b83\u4eec\u7684\u5171\u540c\u70b9\uff1a\u90fd\u5c5e\u4e8e\u5e8f\u5217<\/h2>\n\n\n\n<p>\u4e4b\u6240\u4ee5\u521d\u5b66\u8005\u5bb9\u6613\u6df7\u6dc6\uff0c\u662f\u56e0\u4e3a\u8fd9\u4e09\u4e2a\u7c7b\u578b\u90fd\u6709\u4e00\u4e9b\u5f88\u50cf\u7684\u5730\u65b9\u3002\u5b83\u4eec\u90fd\u5c5e\u4e8e\u201c\u5e8f\u5217\u201d\uff0c\u4e5f\u5c31\u662f\u201c\u6709\u987a\u5e8f\u5730\u6392\u5728\u4e00\u8d77\u7684\u4e00\u4e32\u5185\u5bb9\u201d\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u90fd\u53ef\u4ee5\u7528\u7d22\u5f15\u53d6\u503c<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"python\"\nnums = &#91;10, 20, 30]\npoint = (3, 5)\n\nprint(text&#91;0])\nprint(nums&#91;0])\nprint(point&#91;0])\n<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>p\n10\n3\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u8bf4\u660e\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b57\u7b26\u4e32\u7684\u7b2c 0 \u4e2a\u4f4d\u7f6e\u53ef\u4ee5\u53d6<\/li>\n\n\n\n<li>\u5217\u8868\u7684\u7b2c 0 \u4e2a\u4f4d\u7f6e\u53ef\u4ee5\u53d6<\/li>\n\n\n\n<li>\u5143\u7ec4\u7684\u7b2c 0 \u4e2a\u4f4d\u7f6e\u4e5f\u53ef\u4ee5\u53d6<\/li>\n<\/ul>\n\n\n\n<p>\u6240\u4ee5\uff0c<strong>\u201c\u652f\u6301\u7d22\u5f15\u201d\u5e76\u4e0d\u662f\u5b57\u7b26\u4e32\u6216\u5217\u8868\u72ec\u6709\u7684\u7279\u70b9<\/strong>\uff0c\u5143\u7ec4\u4e5f\u652f\u6301\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u90fd\u53ef\u4ee5\u5207\u7247<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"python\"\nnums = &#91;10, 20, 30, 40]\npoint = (1, 2, 3, 4)\n\nprint(text&#91;1:4])\nprint(nums&#91;1:3])\nprint(point&#91;1:3])\n<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yth\n&#91;20, 30]\n(2, 3)\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cc\u4f60\u4f1a\u770b\u5230\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b57\u7b26\u4e32\u5207\u7247\u540e\u8fd8\u662f\u5b57\u7b26\u4e32<\/li>\n\n\n\n<li>\u5217\u8868\u5207\u7247\u540e\u8fd8\u662f\u5217\u8868<\/li>\n\n\n\n<li>\u5143\u7ec4\u5207\u7247\u540e\u8fd8\u662f\u5143\u7ec4<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u90fd\u53ef\u4ee5\u7528 <code>for<\/code> \u904d\u5386<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"abc\"\nnums = &#91;1, 2, 3]\npoint = (4, 5, 6)\n\nfor x in text:\n    print(x)\n\nfor x in nums:\n    print(x)\n\nfor x in point:\n    print(x)\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e5f\u8bf4\u660e\u5b83\u4eec\u90fd\u80fd\u201c\u6309\u987a\u5e8f\u4e00\u4e2a\u4e00\u4e2a\u62ff\u51fa\u6765\u201d\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u7b2c\u4e00\u4e2a\u6700\u5bb9\u6613\u6df7\u6dc6\u7684\u5730\u65b9\uff1a\u5b83\u4eec\u90fd\u80fd\u53d6\u503c\uff0c\u4f46\u4e0d\u662f\u90fd\u80fd\u6539<\/h2>\n\n\n\n<p>\u8fd9\u662f\u6700\u6838\u5fc3\u3001\u4e5f\u662f\u6700\u5bb9\u6613\u51fa\u9519\u7684\u5730\u65b9\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u7b26\u4e32\u4e0d\u80fd\u6539\u5355\u4e2a\u4f4d\u7f6e<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"hello\"\ntext&#91;0] = \"H\"\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4f1a\u62a5\u9519\u3002<\/p>\n\n\n\n<p>\u539f\u56e0\u4e0d\u662f\u7d22\u5f15\u5199\u9519\uff0c\u800c\u662f\uff1a<strong>\u5b57\u7b26\u4e32\u662f\u4e0d\u53ef\u53d8\u7c7b\u578b<\/strong>\u3002<br>\u4e5f\u5c31\u662f\u8bf4\uff0c\u5b57\u7b26\u4e32\u4e00\u65e6\u521b\u5efa\u597d\uff0c\u91cc\u9762\u7684\u5b57\u7b26\u5c31\u4e0d\u80fd\u539f\u5730\u4fee\u6539\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u5217\u8868\u53ef\u4ee5\u6539\u5355\u4e2a\u4f4d\u7f6e<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>nums = &#91;10, 20, 30]\nnums&#91;0] = 99\nprint(nums)\n<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;99, 20, 30]\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u8bf4\u660e\uff1a<strong>\u5217\u8868\u662f\u53ef\u53d8\u7c7b\u578b<\/strong>\u3002<br>\u5b83\u5141\u8bb8\u4f60\u76f4\u63a5\u4fee\u6539\u67d0\u4e2a\u5143\u7d20\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u5143\u7ec4\u4e5f\u4e0d\u80fd\u6539\u5355\u4e2a\u4f4d\u7f6e<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>point = (3, 5)\npoint&#91;0] = 100\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u540c\u6837\u4f1a\u62a5\u9519\u3002<\/p>\n\n\n\n<p>\u56e0\u4e3a\uff1a<strong>\u5143\u7ec4\u4e5f\u662f\u4e0d\u53ef\u53d8\u7c7b\u578b<\/strong>\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u8fd9\u4e00\u7ec4\u4e00\u5b9a\u8981\u8bb0\u7262<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7c7b\u578b<\/th><th>\u80fd\u5426\u7d22\u5f15<\/th><th>\u80fd\u5426\u76f4\u63a5\u4fee\u6539\u67d0\u4e2a\u4f4d\u7f6e<\/th><\/tr><\/thead><tbody><tr><td>\u5b57\u7b26\u4e32 <code>str<\/code><\/td><td>\u80fd<\/td><td>\u4e0d\u80fd<\/td><\/tr><tr><td>\u5217\u8868 <code>list<\/code><\/td><td>\u80fd<\/td><td>\u80fd<\/td><\/tr><tr><td>\u5143\u7ec4 <code>tuple<\/code><\/td><td>\u80fd<\/td><td>\u4e0d\u80fd<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u6240\u4ee5\uff0c\u652f\u6301\u7d22\u5f15\uff0c\u4e0d\u7b49\u4e8e\u652f\u6301\u4fee\u6539\u3002<br>\u8fd9\u662f\u521d\u5b66\u8005\u6700\u5bb9\u6613\u6df7\u6dc6\u7684\u7b2c\u4e00\u70b9\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u7b2c\u4e8c\u4e2a\u6700\u5bb9\u6613\u6df7\u6dc6\u7684\u5730\u65b9\uff1a\u5b83\u4eec\u7684\u5199\u6cd5\u4e0d\u540c<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u7b26\u4e32\u7528\u5f15\u53f7<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>name = \"Tom\"\nword = 'hello'\n<\/code><\/pre>\n\n\n\n<p>\u5b57\u7b26\u4e32\u4e00\u5b9a\u8981\u7528\u5f15\u53f7\u5305\u8d77\u6765\uff0c\u5355\u5f15\u53f7\u53cc\u5f15\u53f7\u90fd\u53ef\u4ee5\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u5217\u8868\u7528\u65b9\u62ec\u53f7 <code>[]<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>nums = &#91;1, 2, 3]\nnames = &#91;\"Tom\", \"Jack\", \"Lucy\"]\n<\/code><\/pre>\n\n\n\n<p>\u5217\u8868\u4e2d\u7684\u5143\u7d20\u4e4b\u95f4\u7528\u9017\u53f7\u9694\u5f00\uff0c\u5916\u9762\u7528\u65b9\u62ec\u53f7\u5305\u4f4f\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u5143\u7ec4\u7528\u5706\u62ec\u53f7 <code>()<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>point = (3, 5)\ncolors = (\"red\", \"green\", \"blue\")\n<\/code><\/pre>\n\n\n\n<p>\u5143\u7ec4\u7684\u5f62\u5f0f\u548c\u5217\u8868\u5f88\u50cf\uff0c\u53ea\u662f\u5916\u9762\u53d8\u6210\u4e86\u5706\u62ec\u53f7\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u4f46\u662f\u6709\u4e00\u4e2a\u7279\u6b8a\u70b9\uff1a\u53ea\u6709\u4e00\u4e2a\u5143\u7d20\u7684\u5143\u7ec4<\/h3>\n\n\n\n<p>\u8fd9\u70b9\u975e\u5e38\u5bb9\u6613\u51fa\u9519\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a = (5)\nprint(type(a))\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e0d\u662f\u5143\u7ec4\uff0c\u800c\u662f\u6574\u6570\u3002<\/p>\n\n\n\n<p>\u56e0\u4e3a <code>(5)<\/code> \u53ea\u662f\u628a 5 \u7528\u62ec\u53f7\u5305\u8d77\u6765\u4e86\uff0c\u5b83\u672c\u8d28\u4e0a\u8fd8\u662f <code>5<\/code>\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u771f\u60f3\u8868\u793a\u201c\u53ea\u6709\u4e00\u4e2a\u5143\u7d20\u7684\u5143\u7ec4\u201d\uff0c\u5fc5\u987b\u5199\u6210\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a = (5,)\nprint(type(a))\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cc\u6700\u540e\u90a3\u4e2a\u9017\u53f7\u975e\u5e38\u5173\u952e\u3002<\/p>\n\n\n\n<p>\u8f93\u51fa\u662f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;class 'tuple'&gt;\n<\/code><\/pre>\n\n\n\n<p>\u6240\u4ee5\u4f60\u8981\u8bb0\u4f4f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>(5)<\/code> \u4e0d\u662f\u5143\u7ec4<\/li>\n\n\n\n<li><code>(5,)<\/code> \u624d\u662f\u5355\u5143\u7d20\u5143\u7ec4<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u7b2c\u4e09\u4e2a\u6700\u5bb9\u6613\u6df7\u6dc6\u7684\u5730\u65b9\uff1a\u5b83\u4eec\u88c5\u7684\u5185\u5bb9\u770b\u8d77\u6765\u50cf\uff0c\u4f46\u610f\u4e49\u4e0d\u540c<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u7b26\u4e32\u88c5\u7684\u662f\u5b57\u7b26\u5e8f\u5217<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"hello\"\n<\/code><\/pre>\n\n\n\n<p>\u4ece\u8868\u9762\u4e0a\u770b\uff0c\u5b83\u50cf\u662f\u7531 <code>h\u3001e\u3001l\u3001l\u3001o<\/code> \u7ec4\u6210\u7684\u4e00\u4e32\u5185\u5bb9\u3002<br>\u4f46 Python \u628a\u5b83\u5f53\u4f5c\u201c\u6587\u672c\u201d\u6765\u770b\u5f85\u3002<\/p>\n\n\n\n<p>\u6240\u4ee5\u5b57\u7b26\u4e32\u7684\u91cd\u70b9\u4e0d\u662f\u201c\u5b58\u4e86\u5f88\u591a\u5143\u7d20\u201d\uff0c\u800c\u662f\u201c\u8868\u793a\u6587\u5b57\u5185\u5bb9\u201d\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u5217\u8868\u88c5\u7684\u662f\u4e00\u7ec4\u72ec\u7acb\u5143\u7d20<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>nums = &#91;10, 20, 30]\n<\/code><\/pre>\n\n\n\n<p>\u5217\u8868\u66f4\u50cf\u4e00\u4e2a\u201c\u5bb9\u5668\u201d\uff0c\u91cc\u9762\u6bcf\u4e2a\u5143\u7d20\u90fd\u662f\u5f7c\u6b64\u72ec\u7acb\u7684\u3002<br>\u4f60\u53ef\u4ee5\u589e\u52a0\u3001\u5220\u9664\u3001\u4fee\u6539\u5176\u4e2d\u67d0\u4e00\u4e2a\u5143\u7d20\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u5143\u7ec4\u4e5f\u88c5\u4e00\u7ec4\u5143\u7d20\uff0c\u4f46\u5f3a\u8c03\u201c\u4e0d\u53d8\u201d<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>point = (3, 5)\n<\/code><\/pre>\n\n\n\n<p>\u5143\u7ec4\u548c\u5217\u8868\u770b\u8d77\u6765\u5f88\u50cf\uff0c\u4e5f\u80fd\u653e\u591a\u4e2a\u5143\u7d20\u3002<br>\u4f46\u5b83\u66f4\u50cf\u662f\u5728\u8868\u8fbe\uff1a<strong>\u8fd9\u4e00\u7ec4\u6570\u636e\u662f\u56fa\u5b9a\u7684\u4e00\u7ec4\uff0c\u4e0d\u5e0c\u671b\u88ab\u6539\u52a8<\/strong>\u3002<\/p>\n\n\n\n<p>\u6bd4\u5982\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e00\u4e2a\u5750\u6807 <code>(x, y)<\/code><\/li>\n\n\n\n<li>\u4e00\u4e2a\u65e5\u671f <code>(year, month, day)<\/code><\/li>\n\n\n\n<li>\u4e00\u4e2a\u5b66\u751f\u4fe1\u606f\u4e2d\u7684\u56fa\u5b9a\u7ec4\u5408<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u7b2c\u56db\u4e2a\u6700\u5bb9\u6613\u6df7\u6dc6\u7684\u5730\u65b9\uff1a\u5b83\u4eec\u6253\u5370\u51fa\u6765\u7684\u6837\u5b50\u4e0d\u4e00\u6837<\/h2>\n\n\n\n<p>\u5982\u679c\u76f4\u63a5 <code>print()<\/code>\uff0c\u4e09\u8005\u7684\u8868\u73b0\u4e0d\u540c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"hello\"\nnums = &#91;1, 2, 3]\npoint = (4, 5)\n\nprint(text)\nprint(nums)\nprint(point)\n<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hello\n&#91;1, 2, 3]\n(4, 5)\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cc\u4f60\u53ef\u4ee5\u89c2\u5bdf\u5230\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b57\u7b26\u4e32\u6253\u5370\u65f6\uff0c\u76f4\u63a5\u663e\u793a\u5185\u5bb9<\/li>\n\n\n\n<li>\u5217\u8868\u6253\u5370\u65f6\uff0c\u4f1a\u5e26\u65b9\u62ec\u53f7<\/li>\n\n\n\n<li>\u5143\u7ec4\u6253\u5370\u65f6\uff0c\u4f1a\u5e26\u5706\u62ec\u53f7<\/li>\n<\/ul>\n\n\n\n<p>\u6240\u4ee5\u4ee5\u540e\u4f60\u770b\u5230\u8f93\u51fa\u957f\u8fd9\u6837\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>hello<\/code>\uff1a\u901a\u5e38\u662f\u5b57\u7b26\u4e32<\/li>\n\n\n\n<li><code>[1, 2, 3]<\/code>\uff1a\u901a\u5e38\u662f\u5217\u8868<\/li>\n\n\n\n<li><code>(4, 5)<\/code>\uff1a\u901a\u5e38\u662f\u5143\u7ec4<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u7b2c\u4e94\u4e2a\u6700\u5bb9\u6613\u6df7\u6dc6\u7684\u5730\u65b9\uff1a\u5b83\u4eec\u90fd\u80fd\u653e\u591a\u4e2a\u4e1c\u897f\uff0c\u4f46\u201c\u8be5\u4e0d\u8be5\u6539\u201d\u51b3\u5b9a\u4f60\u7528\u54ea\u4e00\u4e2a<\/h2>\n\n\n\n<p>\u8fd9\u4e00\u70b9\u6bd4\u6b7b\u8bb0\u786c\u80cc\u5b9a\u4e49\u66f4\u91cd\u8981\uff0c\u56e0\u4e3a\u5b83\u548c\u201c\u5b9e\u9645\u5199\u4ee3\u7801\u201d\u76f4\u63a5\u76f8\u5173\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u9700\u8981\u4fee\u6539\u65f6\uff0c\u7528\u5217\u8868<\/h3>\n\n\n\n<p>\u6bd4\u5982\u4f60\u8981\u5b58\u50a8\u5b66\u751f\u6210\u7ee9\uff0c\u540e\u9762\u8fd8\u53ef\u80fd\u66f4\u65b0\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>scores = &#91;80, 90, 85]\nscores&#91;1] = 95\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u65f6\u5019\u5c31\u5e94\u8be5\u7528\u5217\u8868\uff0c\u56e0\u4e3a\u4f60\u77e5\u9053\u540e\u9762\u4f1a\u6539\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e0d\u9700\u8981\u4fee\u6539\u65f6\uff0c\u53ef\u4ee5\u7528\u5143\u7ec4<\/h3>\n\n\n\n<p>\u6bd4\u5982\u4e00\u4e2a\u70b9\u7684\u5750\u6807\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>point = (3, 5)\n<\/code><\/pre>\n\n\n\n<p>\u901a\u5e38\u6211\u4eec\u628a\u8fd9\u4e2a\u70b9\u7406\u89e3\u4e3a\u201c\u4e00\u4e2a\u56fa\u5b9a\u5750\u6807\u201d\uff0c\u4e0d\u662f\u62ff\u6765\u9891\u7e41\u6539\u7684\u3002<br>\u8fd9\u65f6\u5143\u7ec4\u5c31\u5f88\u5408\u9002\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u8868\u793a\u6587\u5b57\u5185\u5bb9\u65f6\uff0c\u7528\u5b57\u7b26\u4e32<\/h3>\n\n\n\n<p>\u6bd4\u5982\u540d\u5b57\u3001\u53e5\u5b50\u3001\u5355\u8bcd\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>name = \"Alice\"\nsentence = \"I like Python\"\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u65f6\u5019\u5f53\u7136\u4e0d\u662f\u7528\u5217\u8868\u6216\u5143\u7ec4\uff0c\u800c\u662f\u7528\u5b57\u7b26\u4e32\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u7b2c\u516d\u4e2a\u6700\u5bb9\u6613\u6df7\u6dc6\u7684\u5730\u65b9\uff1a\u5b57\u7b26\u4e32\u7684\u201c\u4e00\u4e2a\u5b57\u7b26\u201d\u548c\u5217\u8868\u7684\u201c\u4e00\u4e2a\u5143\u7d20\u201d\u4e0d\u662f\u4e00\u56de\u4e8b<\/h2>\n\n\n\n<p>\u8fd9\u4e2a\u5730\u65b9\u5f88\u7ec6\uff0c\u4f46\u5f88\u91cd\u8981\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u7b26\u4e32\u53d6\u51fa\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u5f97\u5230\u7684\u8fd8\u662f\u5b57\u7b26\u4e32<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"hello\"\nprint(text&#91;0])\nprint(type(text&#91;0]))\n<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>h\n&lt;class 'str'&gt;\n<\/code><\/pre>\n\n\n\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c\u5b57\u7b26\u4e32\u4e2d\u7684\u4e00\u4e2a\u201c\u5b57\u7b26\u201d\uff0c\u5728 Python \u91cc\u672c\u8d28\u4e0a\u4ecd\u7136\u662f\u5b57\u7b26\u4e32\uff0c\u53ea\u4e0d\u8fc7\u957f\u5ea6\u4e3a 1\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u5217\u8868\u53d6\u51fa\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u5f97\u5230\u7684\u662f\u8be5\u5143\u7d20\u672c\u8eab<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>nums = &#91;10, 20, 30]\nprint(nums&#91;0])\nprint(type(nums&#91;0]))\n<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>10\n&lt;class 'int'&gt;\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cc\u53d6\u51fa\u6765\u7684\u662f\u6574\u6570\uff0c\u56e0\u4e3a\u5217\u8868\u91cc\u653e\u7684\u5c31\u662f\u6574\u6570\u3002<\/p>\n\n\n\n<p>\u6240\u4ee5\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b57\u7b26\u4e32\u53d6\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u8fd8\u662f\u5b57\u7b26\u4e32<\/li>\n\n\n\n<li>\u5217\u8868\u53d6\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u662f\u4ec0\u4e48\u5143\u7d20\u5c31\u5f97\u5230\u4ec0\u4e48\u7c7b\u578b<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u7b2c\u4e03\u4e2a\u6700\u5bb9\u6613\u6df7\u6dc6\u7684\u5730\u65b9\uff1a\u52a0\u53f7 <code>+<\/code> \u90fd\u80fd\u7528\uff0c\u4f46\u610f\u601d\u4e0d\u5b8c\u5168\u4e00\u6837<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u7b26\u4e32\u4e2d\u7684 <code>+<\/code> \u662f\u62fc\u63a5\u6587\u672c<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>a = \"hello\"\nb = \"world\"\nprint(a + b)\n<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>helloworld\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u5217\u8868\u4e2d\u7684 <code>+<\/code> \u662f\u5408\u5e76\u4e24\u4e2a\u5217\u8868<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>a = &#91;1, 2]\nb = &#91;3, 4]\nprint(a + b)\n<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;1, 2, 3, 4]\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u5143\u7ec4\u4e2d\u7684 <code>+<\/code> \u662f\u8fde\u63a5\u4e24\u4e2a\u5143\u7ec4<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>a = (1, 2)\nb = (3, 4)\nprint(a + b)\n<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(1, 2, 3, 4)\n<\/code><\/pre>\n\n\n\n<p>\u6240\u4ee5\u867d\u7136\u4e09\u8005\u90fd\u53ef\u4ee5\u5199 <code>+<\/code>\uff0c\u4f46\u4f60\u8981\u7406\u89e3\u5b83\u4eec\u5404\u81ea\u8fde\u63a5\u7684\u662f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b57\u7b26\u4e32\uff1a\u6587\u672c<\/li>\n\n\n\n<li>\u5217\u8868\uff1a\u5143\u7d20\u5e8f\u5217<\/li>\n\n\n\n<li>\u5143\u7ec4\uff1a\u56fa\u5b9a\u5143\u7d20\u5e8f\u5217<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u7b2c\u516b\u4e2a\u6700\u5bb9\u6613\u6df7\u6dc6\u7684\u5730\u65b9\uff1a\u4e3a\u4ec0\u4e48\u5b57\u7b26\u4e32\u548c\u5143\u7ec4\u4e0d\u80fd\u6539\uff0c\u5217\u8868\u5374\u80fd\u6539<\/h2>\n\n\n\n<p>\u8fd9\u4e00\u70b9\u4f60\u4e0d\u7528\u4e00\u5f00\u59cb\u5c31\u4ece\u7279\u522b\u6df1\u7684\u539f\u7406\u7406\u89e3\uff0c\u4f46\u8981\u6709\u4e00\u4e2a\u521d\u6b65\u8ba4\u8bc6\u3002<\/p>\n\n\n\n<p>Python \u8bbe\u8ba1\u8fd9\u4e09\u79cd\u7c7b\u578b\uff0c\u672c\u6765\u5c31\u662f\u4e3a\u4e86\u4e0d\u540c\u7684\u7528\u9014\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5b57\u7b26\u4e32<\/strong>\uff1a\u4e3b\u8981\u662f\u8868\u793a\u6587\u672c\uff0c\u901a\u5e38\u4e0d\u9700\u8981\u539f\u5730\u6539\u5b57\u7b26<\/li>\n\n\n\n<li><strong>\u5217\u8868<\/strong>\uff1a\u4e3b\u8981\u662f\u5b58\u4e00\u7ec4\u53ef\u53d8\u5316\u7684\u6570\u636e\uff0c\u6240\u4ee5\u5141\u8bb8\u4fee\u6539<\/li>\n\n\n\n<li><strong>\u5143\u7ec4<\/strong>\uff1a\u4e3b\u8981\u662f\u8868\u793a\u4e00\u7ec4\u56fa\u5b9a\u7684\u6570\u636e\uff0c\u6240\u4ee5\u4e0d\u5141\u8bb8\u4fee\u6539<\/li>\n<\/ul>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u5148\u628a\u5b83\u7406\u89e3\u6210\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b57\u7b26\u4e32\uff1a\u66f4\u50cf\u201c\u5199\u597d\u7684\u6587\u5b57\u201d<\/li>\n\n\n\n<li>\u5217\u8868\uff1a\u66f4\u50cf\u201c\u53ef\u4ee5\u968f\u65f6\u6574\u7406\u7684\u6e05\u5355\u201d<\/li>\n\n\n\n<li>\u5143\u7ec4\uff1a\u66f4\u50cf\u201c\u786e\u5b9a\u4e0b\u6765\u7684\u8bb0\u5f55\u201d<\/li>\n<\/ul>\n\n\n\n<p>\u8fd9\u4e2a\u7406\u89e3\u5bf9\u521d\u5b66\u9636\u6bb5\u5df2\u7ecf\u591f\u7528\u4e86\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u7528\u4e00\u4e2a\u5bf9\u6bd4\u4f8b\u5b50\u628a\u4e09\u8005\u653e\u5728\u4e00\u8d77\u770b<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"abc\"\nnums = &#91;\"a\", \"b\", \"c\"]\npoint = (\"a\", \"b\", \"c\")\n\nprint(text&#91;1])\nprint(nums&#91;1])\nprint(point&#91;1])\n<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\u90fd\u662f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>b\n<\/code><\/pre>\n\n\n\n<p>\u6240\u4ee5\u8868\u9762\u4e0a\u770b\uff0c\u5b83\u4eec\u5f88\u50cf\u3002<\/p>\n\n\n\n<p>\u4f46\u662f\u4e0b\u9762\u5c31\u4e0d\u4e00\u6837\u4e86\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nums&#91;1] = \"x\"\nprint(nums)\n<\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u6267\u884c\uff0c\u7ed3\u679c\u662f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;'a', 'x', 'c']\n<\/code><\/pre>\n\n\n\n<p>\u800c\u4e0b\u9762\u4e24\u53e5\u90fd\u4f1a\u62a5\u9519\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>text&#91;1] = \"x\"\npoint&#91;1] = \"x\"\n<\/code><\/pre>\n\n\n\n<p>\u6240\u4ee5\u771f\u6b63\u7684\u5dee\u522b\u4e0d\u5728\u201c\u80fd\u4e0d\u80fd\u53d6\u201d\uff0c\u800c\u5728\u201c\u80fd\u4e0d\u80fd\u6539\u201d\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u9645\u5199\u4ee3\u7801\u65f6\uff0c\u600e\u4e48\u5224\u65ad\u8be5\u7528\u54ea\u4e00\u4e2a<\/h2>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u5148\u95ee\u81ea\u5df1\u4e09\u4e2a\u95ee\u9898\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u95ee\u9898\u4e00\uff1a\u6211\u73b0\u5728\u5904\u7406\u7684\u662f\u4e0d\u662f\u6587\u672c\uff1f<\/h3>\n\n\n\n<p>\u5982\u679c\u662f\u6587\u672c\uff0c\u5c31\u4f18\u5148\u60f3\u5230\u5b57\u7b26\u4e32\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7528\u6237\u59d3\u540d<\/li>\n\n\n\n<li>\u4e00\u53e5\u8bdd<\/li>\n\n\n\n<li>\u8f93\u5165\u7684\u4e00\u884c\u5185\u5bb9<\/li>\n\n\n\n<li>\u4e00\u4e2a\u5355\u8bcd<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>name = \"Tom\"\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u95ee\u9898\u4e8c\uff1a\u6211\u5b58\u7684\u662f\u4e0d\u662f\u4e00\u7ec4\u6570\u636e\uff0c\u800c\u4e14\u540e\u9762\u53ef\u80fd\u4f1a\u6539\uff1f<\/h3>\n\n\n\n<p>\u5982\u679c\u4f1a\u6539\uff0c\u7528\u5217\u8868\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6210\u7ee9\u5217\u8868<\/li>\n\n\n\n<li>\u5546\u54c1\u6e05\u5355<\/li>\n\n\n\n<li>\u591a\u4e2a\u6570\u5b57<\/li>\n\n\n\n<li>\u591a\u4e2a\u540d\u5b57<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>scores = &#91;90, 85, 100]\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u95ee\u9898\u4e09\uff1a\u6211\u5b58\u7684\u662f\u4e0d\u662f\u4e00\u7ec4\u56fa\u5b9a\u642d\u914d\u7684\u6570\u636e\uff0c\u4e0d\u5e0c\u671b\u6539\uff1f<\/h3>\n\n\n\n<p>\u5982\u679c\u662f\uff0c\u7528\u5143\u7ec4\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e00\u4e2a\u5750\u6807<\/li>\n\n\n\n<li>\u4e00\u4e2a\u65e5\u671f<\/li>\n\n\n\n<li>\u4e00\u7ec4\u56fa\u5b9a\u914d\u7f6e<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>date = (2026, 4, 20)\npoint = (3, 5)\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u4e2a\u7b80\u5355\u5bf9\u6bd4\u8868\uff0c\u5e2e\u52a9\u4f60\u5feb\u901f\u590d\u4e60<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u5bf9\u6bd4\u9879<\/th><th>\u5b57\u7b26\u4e32 <code>str<\/code><\/th><th>\u5217\u8868 <code>list<\/code><\/th><th>\u5143\u7ec4 <code>tuple<\/code><\/th><\/tr><\/thead><tbody><tr><td>\u4e3b\u8981\u4f5c\u7528<\/td><td>\u8868\u793a\u6587\u672c<\/td><td>\u5b58\u653e\u4e00\u7ec4\u53ef\u53d8\u6570\u636e<\/td><td>\u5b58\u653e\u4e00\u7ec4\u56fa\u5b9a\u6570\u636e<\/td><\/tr><tr><td>\u5199\u6cd5<\/td><td><code>\"hello\"<\/code><\/td><td><code>[1, 2, 3]<\/code><\/td><td><code>(1, 2, 3)<\/code><\/td><\/tr><tr><td>\u662f\u5426\u6709\u987a\u5e8f<\/td><td>\u6709<\/td><td>\u6709<\/td><td>\u6709<\/td><\/tr><tr><td>\u662f\u5426\u80fd\u7d22\u5f15<\/td><td>\u80fd<\/td><td>\u80fd<\/td><td>\u80fd<\/td><\/tr><tr><td>\u662f\u5426\u80fd\u5207\u7247<\/td><td>\u80fd<\/td><td>\u80fd<\/td><td>\u80fd<\/td><\/tr><tr><td>\u662f\u5426\u80fd\u904d\u5386<\/td><td>\u80fd<\/td><td>\u80fd<\/td><td>\u80fd<\/td><\/tr><tr><td>\u662f\u5426\u80fd\u4fee\u6539\u5143\u7d20<\/td><td>\u4e0d\u80fd<\/td><td>\u80fd<\/td><td>\u4e0d\u80fd<\/td><\/tr><tr><td>\u76f4\u63a5\u6253\u5370\u6548\u679c<\/td><td><code>hello<\/code><\/td><td><code>[1, 2, 3]<\/code><\/td><td><code>(1, 2, 3)<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u5e38\u89c1\u9519\u8bef\u4e0e\u6613\u6df7\u70b9<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u4ee5\u4e3a\u201c\u80fd\u7d22\u5f15\u201d\u5c31\u4e00\u5b9a\u201c\u80fd\u4fee\u6539\u201d<\/h3>\n\n\n\n<p>\u8fd9\u662f\u6700\u5e38\u89c1\u9519\u8bef\u3002<br>\u5b57\u7b26\u4e32\u548c\u5143\u7ec4\u90fd\u80fd\u7d22\u5f15\uff0c\u4f46\u90fd\u4e0d\u80fd\u76f4\u63a5\u6539\u67d0\u4e2a\u4f4d\u7f6e\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u628a\u5143\u7ec4\u548c\u5217\u8868\u53ea\u770b\u6210\u201c\u62ec\u53f7\u4e0d\u4e00\u6837\u201d<\/h3>\n\n\n\n<p>\u5b83\u4eec\u4e0d\u53ea\u662f\u62ec\u53f7\u4e0d\u4e00\u6837\uff0c\u66f4\u91cd\u8981\u7684\u662f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5217\u8868\u53ef\u53d8<\/li>\n\n\n\n<li>\u5143\u7ec4\u4e0d\u53ef\u53d8<\/li>\n<\/ul>\n\n\n\n<p>\u62ec\u53f7\u53ea\u662f\u5916\u5728\u5f62\u5f0f\uff0c\u6838\u5fc3\u533a\u522b\u662f\u201c\u80fd\u4e0d\u80fd\u6539\u201d\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u628a <code>(5)<\/code> \u5f53\u6210\u5143\u7ec4<\/h3>\n\n\n\n<p>\u8fd9\u662f\u521d\u5b66\u8005\u975e\u5e38\u5bb9\u6613\u8e29\u5751\u7684\u5730\u65b9\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a = (5)\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e0d\u662f\u5143\u7ec4\u3002<\/p>\n\n\n\n<p>\u771f\u6b63\u7684\u5355\u5143\u7d20\u5143\u7ec4\u8981\u5199\u6210\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a = (5,)\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">4. \u628a\u5b57\u7b26\u4e32\u770b\u6210\u201c\u5b57\u7b26\u5217\u8868\u201d<\/h3>\n\n\n\n<p>\u5b57\u7b26\u4e32\u867d\u7136\u4e5f\u80fd\u4e00\u4e2a\u4e2a\u53d6\u5b57\u7b26\uff0c\u4f46\u5b83\u4e0d\u662f\u5217\u8868\u3002<br>\u5b83\u662f\u4e13\u95e8\u8868\u793a\u6587\u672c\u7684\u7c7b\u578b\uff0c\u5f88\u591a\u884c\u4e3a\u548c\u5217\u8868\u4e0d\u540c\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u672c\u8282\u5c0f\u7ed3<\/h2>\n\n\n\n<p>\u8fd9\u4e00\u8282\u6700\u91cd\u8981\u7684\u4e0d\u662f\u8bb0\u4f4f\u5f88\u591a\u672f\u8bed\uff0c\u800c\u662f\u8bb0\u4f4f\u4e0b\u9762\u8fd9\u4e09\u53e5\u8bdd\uff1a<\/p>\n\n\n\n<p><strong>\u5b57\u7b26\u4e32\u662f\u6587\u672c\u3002<\/strong><br><strong>\u5217\u8868\u662f\u53ef\u4ee5\u4fee\u6539\u7684\u4e00\u7ec4\u6570\u636e\u3002<\/strong><br><strong>\u5143\u7ec4\u662f\u4e0d\u60f3\u4fee\u6539\u7684\u4e00\u7ec4\u6570\u636e\u3002<\/strong><\/p>\n\n\n\n<p>\u518d\u8fdb\u4e00\u6b65\uff0c\u4f60\u53ef\u4ee5\u8fd9\u6837\u8bb0\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u90fd\u6709\u987a\u5e8f\uff0c\u6240\u4ee5\u90fd\u80fd\u7d22\u5f15\u3001\u5207\u7247\u3001\u904d\u5386<\/li>\n\n\n\n<li>\u771f\u6b63\u62c9\u5f00\u5dee\u8ddd\u7684\u662f\uff1a<strong>\u5217\u8868\u80fd\u6539\uff0c\u5b57\u7b26\u4e32\u548c\u5143\u7ec4\u4e0d\u80fd\u6539<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u5982\u679c\u4f60\u628a\u8fd9\u4e00\u5c42\u5f04\u660e\u767d\uff0c\u540e\u9762\u5b66\u4e60\u5b57\u7b26\u4e32\u64cd\u4f5c\u3001\u5217\u8868\u64cd\u4f5c\u3001\u51fd\u6570\u4f20\u53c2\u3001\u89e3\u5305\u7b49\u5185\u5bb9\u65f6\uff0c\u4f1a\u987a\u5f88\u591a\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u6700\u5c0f\u53ef\u8fd0\u884c\u4f8b\u5b50<\/h2>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801\uff0c\u628a\u4e09\u8005\u653e\u5728\u4e00\u8d77\u611f\u53d7\u4e00\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"python\"\nnums = &#91;10, 20, 30]\npoint = (1, 2, 3)\n\nprint(\"\u5b57\u7b26\u4e32:\", text)\nprint(\"\u5217\u8868:\", nums)\nprint(\"\u5143\u7ec4:\", point)\n\nprint(text&#91;0])\nprint(nums&#91;0])\nprint(point&#91;0])\n\nnums&#91;1] = 99\nprint(\"\u4fee\u6539\u540e\u7684\u5217\u8868:\", nums)\n<\/code><\/pre>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u81ea\u5df1\u518d\u8bd5\u7740\u628a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>text&#91;1] = \"X\"\npoint&#91;1] = 100\n<\/code><\/pre>\n\n\n\n<p>\u52a0\u8fdb\u53bb\u770b\u770b\u62a5\u4ec0\u4e48\u9519\uff0c\u8fd9\u6837\u5370\u8c61\u4f1a\u66f4\u6df1\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u7ec3\u4e60<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u9898\u76ee<\/h3>\n\n\n\n<p>\u8bf7\u4f60\u81ea\u5df1\u5199\u4e00\u6bb5\u7a0b\u5e8f\uff0c\u5b8c\u6210\u4e0b\u9762\u8fd9\u4e9b\u4e8b\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5b9a\u4e49\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u5185\u5bb9\u662f <code>\"hello\"<\/code><\/li>\n\n\n\n<li>\u5b9a\u4e49\u4e00\u4e2a\u5217\u8868\uff0c\u5185\u5bb9\u662f <code>[1, 2, 3]<\/code><\/li>\n\n\n\n<li>\u5b9a\u4e49\u4e00\u4e2a\u5143\u7ec4\uff0c\u5185\u5bb9\u662f <code>(4, 5, 6)<\/code><\/li>\n\n\n\n<li>\u5206\u522b\u6253\u5370\u5b83\u4eec\u7684\u7b2c 1 \u4e2a\u5143\u7d20<\/li>\n\n\n\n<li>\u628a\u5217\u8868\u7684\u7b2c 1 \u4e2a\u5143\u7d20\u6539\u6210 <code>99<\/code><\/li>\n\n\n\n<li>\u518d\u6253\u5370\u4fee\u6539\u540e\u7684\u5217\u8868<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u63d0\u793a<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7b2c 1 \u4e2a\u5143\u7d20\u5bf9\u5e94\u7684\u7d22\u5f15\u662f <code>0<\/code><\/li>\n\n\n\n<li>\u53ea\u6709\u5217\u8868\u53ef\u4ee5\u76f4\u63a5\u7528 <code>\u5217\u8868\u540d[\u7d22\u5f15] = \u65b0\u503c<\/code><\/li>\n\n\n\n<li>\u5b57\u7b26\u4e32\u548c\u5143\u7ec4\u5148\u4e0d\u8981\u5c1d\u8bd5\u4fee\u6539\uff0c\u5426\u5219\u4f1a\u62a5\u9519<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Python \u5165\u95e8\u9636\u6bb5\uff0cstr \u5b57\u7b26\u4e32\u3001list \u5217\u8868\u3001tuple \u5143\u7ec4\uff0c\u5e38\u5e38\u4f1a\u4e00\u8d77\u51fa\u73b0\u3002\u5b83\u4eec\u6709\u4e00\u4e2a\u5171\u540c\u70b9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[],"class_list":["post-2029","post","type-post","status-publish","format-standard","hentry","category-text"],"_links":{"self":[{"href":"http:\/\/www.preluna.xyz\/index.php\/wp-json\/wp\/v2\/posts\/2029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.preluna.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.preluna.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.preluna.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.preluna.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=2029"}],"version-history":[{"count":1,"href":"http:\/\/www.preluna.xyz\/index.php\/wp-json\/wp\/v2\/posts\/2029\/revisions"}],"predecessor-version":[{"id":2030,"href":"http:\/\/www.preluna.xyz\/index.php\/wp-json\/wp\/v2\/posts\/2029\/revisions\/2030"}],"wp:attachment":[{"href":"http:\/\/www.preluna.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=2029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.preluna.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=2029"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.preluna.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=2029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}