{"id":1136006,"date":"2025-01-08T21:31:24","date_gmt":"2025-01-08T13:31:24","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1136006.html"},"modified":"2025-01-08T21:31:26","modified_gmt":"2025-01-08T13:31:26","slug":"python3%e5%ad%97%e5%85%b8%e4%b8%ad%e5%ad%98%e5%82%a8%e5%88%97%e8%a1%a8%e5%a6%82%e4%bd%95%e5%88%9b%e5%bb%ba","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1136006.html","title":{"rendered":"python3\u5b57\u5178\u4e2d\u5b58\u50a8\u5217\u8868\u5982\u4f55\u521b\u5efa"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25104510\/41764dc7-bbb6-437b-8935-8c1df32e5866.webp\" alt=\"python3\u5b57\u5178\u4e2d\u5b58\u50a8\u5217\u8868\u5982\u4f55\u521b\u5efa\" \/><\/p>\n<p><p> <strong>\u5728Python3\u4e2d\u521b\u5efa\u4e00\u4e2a\u5b58\u50a8\u5217\u8868\u7684\u5b57\u5178\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528\u5927\u62ec\u53f7\u3001\u5b57\u5178\u63a8\u5bfc\u5f0f\u3001\u5185\u7f6e\u51fd\u6570dict()\u3002\u5176\u4e2d\uff0c\u4f7f\u7528\u5927\u62ec\u53f7\u7684\u65b9\u6cd5\u6700\u4e3a\u5e38\u89c1\uff0c\u56e0\u4e3a\u5176\u7b80\u6d01\u6613\u61c2\u3002<\/strong><\/p>\n<\/p>\n<p><p>\u8be6\u7ec6\u63cf\u8ff0\uff1a<strong>\u4f7f\u7528\u5927\u62ec\u53f7\u7684\u65b9\u6cd5\u521b\u5efa\u5b57\u5178<\/strong>\u3002\u5728Python3\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5927\u62ec\u53f7 <code>{}<\/code> \u7684\u65b9\u5f0f\u76f4\u63a5\u521b\u5efa\u4e00\u4e2a\u5b57\u5178\uff0c\u5e76\u5728\u5b57\u5178\u4e2d\u4e3a\u6bcf\u4e2a\u952e\u8d4b\u503c\u4e3a\u5217\u8868\u3002\u4f8b\u5982\uff0c<code>my_dict = {&#39;key1&#39;: [1, 2, 3], &#39;key2&#39;: [4, 5, 6]}<\/code>\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4ec5\u76f4\u89c2\uff0c\u800c\u4e14\u80fd\u591f\u7075\u6d3b\u5730\u5728\u5b57\u5178\u4e2d\u6dfb\u52a0\u6216\u5220\u9664\u952e\u503c\u5bf9\uff0c\u975e\u5e38\u9002\u5408\u521d\u5b66\u8005\u548c\u65e5\u5e38\u7f16\u7a0b\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528\u5927\u62ec\u53f7\u521b\u5efa\u5b57\u5178<\/h3>\n<\/p>\n<p><p>\u5728Python3\u4e2d\uff0c\u4f7f\u7528\u5927\u62ec\u53f7 <code>{}<\/code> \u521b\u5efa\u5b57\u5178\u662f\u4e00\u79cd\u975e\u5e38\u76f4\u89c2\u548c\u5e38\u7528\u7684\u65b9\u6cd5\u3002\u53ef\u4ee5\u5728\u5927\u62ec\u53f7\u5185\u5b9a\u4e49\u952e\u503c\u5bf9\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u5217\u8868\u7c7b\u578b\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_dict = {<\/p>\n<p>    &#39;fruits&#39;: [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;],<\/p>\n<p>    &#39;vegetables&#39;: [&#39;carrot&#39;, &#39;lettuce&#39;, &#39;pepper&#39;]<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>my_dict<\/code> \u662f\u4e00\u4e2a\u5b57\u5178\uff0c\u5176\u4e2d\u5305\u542b\u4e24\u4e2a\u952e <code>&#39;fruits&#39;<\/code> \u548c <code>&#39;vegetables&#39;<\/code>\uff0c\u6bcf\u4e2a\u952e\u7684\u503c\u90fd\u662f\u4e00\u4e2a\u5217\u8868\u3002<\/p>\n<\/p>\n<p><h4>\u64cd\u4f5c\u5b57\u5178\u4e2d\u7684\u5217\u8868<\/h4>\n<\/p>\n<p><p>\u901a\u8fc7\u952e\u53ef\u4ee5\u8bbf\u95ee\u5b57\u5178\u4e2d\u7684\u5217\u8868\uff0c\u5e76\u5bf9\u5217\u8868\u8fdb\u884c\u5404\u79cd\u64cd\u4f5c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u64cd\u4f5c\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u6dfb\u52a0\u5143\u7d20\u5230\u5217\u8868<\/strong>\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">my_dict[&#39;fruits&#39;].append(&#39;orange&#39;)<\/p>\n<p>print(my_dict[&#39;fruits&#39;])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u4ece\u5217\u8868\u4e2d\u79fb\u9664\u5143\u7d20<\/strong>\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">my_dict[&#39;vegetables&#39;].remove(&#39;carrot&#39;)<\/p>\n<p>print(my_dict[&#39;vegetables&#39;])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li><strong>\u8bbf\u95ee\u5217\u8868\u4e2d\u7684\u5143\u7d20<\/strong>\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">first_fruit = my_dict[&#39;fruits&#39;][0]<\/p>\n<p>print(first_fruit)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528\u5b57\u5178\u63a8\u5bfc\u5f0f\u521b\u5efa\u5b57\u5178<\/h3>\n<\/p>\n<p><p>\u5b57\u5178\u63a8\u5bfc\u5f0f\u662f\u4e00\u79cd\u7b80\u6d01\u7684\u65b9\u5f0f\u6765\u521b\u5efa\u5b57\u5178\uff0c\u7279\u522b\u662f\u5728\u9700\u8981\u4ece\u73b0\u6709\u6570\u636e\u7ed3\u6784\u751f\u6210\u5b57\u5178\u65f6\u975e\u5e38\u6709\u7528\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4f8b\u5b50\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">keys = [&#39;fruits&#39;, &#39;vegetables&#39;]<\/p>\n<p>values = [[&#39;apple&#39;, &#39;banana&#39;], [&#39;carrot&#39;, &#39;lettuce&#39;]]<\/p>\n<p>my_dict = {k: v for k, v in zip(keys, values)}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 <code>zip(keys, values)<\/code> \u5c06\u4e24\u4e2a\u5217\u8868\u7ec4\u5408\u6210\u4e00\u4e2a\u8fed\u4ee3\u5668\uff0c\u5e76\u901a\u8fc7\u5b57\u5178\u63a8\u5bfc\u5f0f\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u5178\u3002<\/p>\n<\/p>\n<p><h4>\u5b57\u5178\u63a8\u5bfc\u5f0f\u7684\u5e94\u7528\u573a\u666f<\/h4>\n<\/p>\n<p><p>\u5b57\u5178\u63a8\u5bfc\u5f0f\u5728\u5904\u7406\u5927\u91cf\u6570\u636e\u6216\u8005\u9700\u8981\u4ece\u73b0\u6709\u5217\u8868\u3001\u5143\u7ec4\u7b49\u6570\u636e\u7ed3\u6784\u751f\u6210\u5b57\u5178\u65f6\u5c24\u4e3a\u65b9\u4fbf\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [<\/p>\n<p>    (&#39;fruits&#39;, [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]),<\/p>\n<p>    (&#39;vegetables&#39;, [&#39;carrot&#39;, &#39;lettuce&#39;, &#39;pepper&#39;])<\/p>\n<p>]<\/p>\n<p>my_dict = {key: value for key, value in data}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u5185\u7f6e\u51fd\u6570 dict() \u521b\u5efa\u5b57\u5178<\/h3>\n<\/p>\n<p><p>Python\u7684\u5185\u7f6e\u51fd\u6570 <code>dict()<\/code> \u53ef\u4ee5\u5c06\u4e00\u7cfb\u5217\u952e\u503c\u5bf9\u8f6c\u6362\u4e3a\u5b57\u5178\u3002\u867d\u7136\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u5982\u5927\u62ec\u53f7\u548c\u5b57\u5178\u63a8\u5bfc\u5f0f\u5e38\u7528\uff0c\u4f46\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u975e\u5e38\u6709\u7528\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_dict = dict(<\/p>\n<p>    fruits=[&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;],<\/p>\n<p>    vegetables=[&#39;carrot&#39;, &#39;lettuce&#39;, &#39;pepper&#39;]<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 <code>dict()<\/code> \u51fd\u6570\u521b\u5efa\u4e86\u4e00\u4e2a\u5b57\u5178\uff0c\u5176\u4e2d\u7684\u952e\u503c\u5bf9\u662f\u4ee5\u53c2\u6570\u7684\u5f62\u5f0f\u4f20\u9012\u7684\u3002<\/p>\n<\/p>\n<p><h4>\u7ed3\u5408\u5217\u8868\u751f\u6210\u5668\u548c dict() \u51fd\u6570<\/h4>\n<\/p>\n<p><p>\u5f53\u9700\u8981\u4ece\u73b0\u6709\u6570\u636e\u751f\u6210\u5b57\u5178\u65f6\uff0c\u53ef\u4ee5\u7ed3\u5408\u5217\u8868\u751f\u6210\u5668\u548c <code>dict()<\/code> \u51fd\u6570\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">keys = [&#39;fruits&#39;, &#39;vegetables&#39;]<\/p>\n<p>values = [[&#39;apple&#39;, &#39;banana&#39;], [&#39;carrot&#39;, &#39;lettuce&#39;]]<\/p>\n<p>my_dict = dict(zip(keys, values))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u4e0e\u5b57\u5178\u63a8\u5bfc\u5f0f\u7c7b\u4f3c\uff0c\u901a\u8fc7 <code>zip(keys, values)<\/code> \u5c06\u4e24\u4e2a\u5217\u8868\u7ec4\u5408\u6210\u4e00\u4e2a\u8fed\u4ee3\u5668\uff0c\u5e76\u4f7f\u7528 <code>dict()<\/code> \u51fd\u6570\u751f\u6210\u5b57\u5178\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u5b57\u5178\u4e2d\u5b58\u50a8\u5217\u8868\u7684\u5b9e\u9645\u5e94\u7528<\/h3>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5b57\u5178\u4e2d\u5b58\u50a8\u5217\u8868\u7684\u7ed3\u6784\u975e\u5e38\u5e38\u89c1\uff0c\u7279\u522b\u662f\u5728\u5904\u7406\u590d\u6742\u6570\u636e\u65f6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5b9e\u9645\u5e94\u7528\u7684\u4f8b\u5b50\uff1a<\/p>\n<\/p>\n<p><h4>1. \u5b66\u751f\u6210\u7ee9\u7ba1\u7406\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728\u4e00\u4e2a\u5b66\u751f\u6210\u7ee9\u7ba1\u7406\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b57\u5178\u6765\u5b58\u50a8\u6bcf\u4e2a\u5b66\u751f\u7684\u6210\u7ee9\u5217\u8868\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">student_grades = {<\/p>\n<p>    &#39;Alice&#39;: [85, 90, 78],<\/p>\n<p>    &#39;Bob&#39;: [82, 88, 91],<\/p>\n<p>    &#39;Charlie&#39;: [95, 92, 89]<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u8fd9\u79cd\u7ed3\u6784\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406\u548c\u8bbf\u95ee\u6bcf\u4e2a\u5b66\u751f\u7684\u6210\u7ee9\u3002<\/p>\n<\/p>\n<p><h4>2. \u4ea7\u54c1\u5e93\u5b58\u7ba1\u7406\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728\u4e00\u4e2a\u4ea7\u54c1\u5e93\u5b58\u7ba1\u7406\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b57\u5178\u6765\u5b58\u50a8\u6bcf\u79cd\u4ea7\u54c1\u7684\u5e93\u5b58\u5217\u8868\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">product_inventory = {<\/p>\n<p>    &#39;Laptops&#39;: [10, 15, 7],<\/p>\n<p>    &#39;Smartphones&#39;: [30, 22, 18],<\/p>\n<p>    &#39;Tablets&#39;: [5, 8, 12]<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u8fd9\u79cd\u7ed3\u6784\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406\u548c\u66f4\u65b0\u6bcf\u79cd\u4ea7\u54c1\u7684\u5e93\u5b58\u6570\u91cf\u3002<\/p>\n<\/p>\n<p><h4>3. \u793e\u4ea4\u5a92\u4f53\u7528\u6237\u5173\u6ce8\u5217\u8868<\/h4>\n<\/p>\n<p><p>\u5728\u4e00\u4e2a\u793e\u4ea4\u5a92\u4f53\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b57\u5178\u6765\u5b58\u50a8\u6bcf\u4e2a\u7528\u6237\u7684\u5173\u6ce8\u5217\u8868\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">user_following = {<\/p>\n<p>    &#39;user1&#39;: [&#39;user2&#39;, &#39;user3&#39;, &#39;user4&#39;],<\/p>\n<p>    &#39;user2&#39;: [&#39;user1&#39;, &#39;user3&#39;],<\/p>\n<p>    &#39;user3&#39;: [&#39;user1&#39;, &#39;user4&#39;]<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u8fd9\u79cd\u7ed3\u6784\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406\u548c\u8bbf\u95ee\u6bcf\u4e2a\u7528\u6237\u7684\u5173\u6ce8\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5728Python3\u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u5b58\u50a8\u5217\u8868\u7684\u5b57\u5178\u6709\u591a\u79cd\u65b9\u6cd5\uff0c\u5176\u4e2d\u4f7f\u7528\u5927\u62ec\u53f7\u7684\u65b9\u6cd5\u6700\u4e3a\u5e38\u89c1\u548c\u7b80\u6d01\u3002\u5176\u4ed6\u65b9\u6cd5\u5982\u5b57\u5178\u63a8\u5bfc\u5f0f\u548c\u5185\u7f6e\u51fd\u6570 <code>dict()<\/code> \u4e5f\u975e\u5e38\u6709\u7528\uff0c\u7279\u522b\u662f\u5728\u5904\u7406\u5927\u91cf\u6570\u636e\u6216\u8005\u4ece\u73b0\u6709\u6570\u636e\u7ed3\u6784\u751f\u6210\u5b57\u5178\u65f6\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5b57\u5178\u4e2d\u5b58\u50a8\u5217\u8868\u7684\u7ed3\u6784\u975e\u5e38\u5e38\u89c1\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5b66\u751f\u6210\u7ee9\u7ba1\u7406\u3001\u4ea7\u54c1\u5e93\u5b58\u7ba1\u7406\u3001\u793e\u4ea4\u5a92\u4f53\u7528\u6237\u5173\u6ce8\u5217\u8868\u7b49\u5404\u79cd\u573a\u666f\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u7075\u6d3b\u8fd0\u7528\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u7ba1\u7406\u548c\u64cd\u4f5c\u590d\u6742\u6570\u636e\uff0c\u63d0\u5347\u7f16\u7a0b\u6548\u7387\u3002\u65e0\u8bba\u662f\u521d\u5b66\u8005\u8fd8\u662f\u6709\u7ecf\u9a8c\u7684\u5f00\u53d1\u8005\uff0c\u90fd\u53ef\u4ee5\u4ece\u4e2d\u53d7\u76ca\uff0c\u7f16\u5199\u51fa\u66f4\u9ad8\u6548\u3001\u66f4\u7b80\u6d01\u7684\u4ee3\u7801\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u5217\u8868\u7684\u5b57\u5178\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5c06\u5217\u8868\u4f5c\u4e3a\u503c\u6765\u8f7b\u677e\u521b\u5efa\u4e00\u4e2a\u5b57\u5178\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u4ee3\u7801\uff1a  <\/p>\n<pre><code class=\"language-python\">my_dict = {\n    &#39;fruits&#39;: [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;],\n    &#39;vegetables&#39;: [&#39;carrot&#39;, &#39;broccoli&#39;]\n}\n<\/code><\/pre>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u5b57\u5178<code>my_dict<\/code>\u7684\u952e\u662f<code>fruits<\/code>\u548c<code>vegetables<\/code>\uff0c\u5bf9\u5e94\u7684\u503c\u662f\u5217\u8868\u3002<\/p>\n<p><strong>\u5728\u5b57\u5178\u4e2d\u5982\u4f55\u5411\u73b0\u6709\u5217\u8868\u6dfb\u52a0\u65b0\u5143\u7d20\uff1f<\/strong><br \/>\u82e5\u60f3\u5411\u5b57\u5178\u4e2d\u7684\u67d0\u4e2a\u952e\u5bf9\u5e94\u7684\u5217\u8868\u6dfb\u52a0\u65b0\u5143\u7d20\uff0c\u53ef\u4ee5\u4f7f\u7528<code>append()<\/code>\u65b9\u6cd5\u3002\u4ee5\u4e0b\u662f\u793a\u4f8b\u4ee3\u7801\uff1a  <\/p>\n<pre><code class=\"language-python\">my_dict[&#39;fruits&#39;].append(&#39;orange&#39;)\n<\/code><\/pre>\n<p>\u8fd9\u6837\uff0c<code>fruits<\/code>\u952e\u5bf9\u5e94\u7684\u5217\u8868\u5c06\u66f4\u65b0\u4e3a<code>[&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;, &#39;orange&#39;]<\/code>\u3002<\/p>\n<p><strong>\u5b57\u5178\u4e2d\u5b58\u50a8\u7684\u5217\u8868\u53ef\u4ee5\u5305\u542b\u4e0d\u540c\u7c7b\u578b\u7684\u6570\u636e\u5417\uff1f<\/strong><br \/>\u5b8c\u5168\u53ef\u4ee5\uff01\u5728Python\u7684\u5b57\u5178\u4e2d\uff0c\u5217\u8868\u53ef\u4ee5\u5305\u542b\u591a\u79cd\u6570\u636e\u7c7b\u578b\uff0c\u5305\u62ec\u6570\u5b57\u3001\u5b57\u7b26\u4e32\u3001\u751a\u81f3\u662f\u5176\u4ed6\u5b57\u5178\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4f8b\u5b50\uff1a  <\/p>\n<pre><code class=\"language-python\">mixed_dict = {\n    &#39;numbers&#39;: [1, 2, 3],\n    &#39;names&#39;: [&#39;Alice&#39;, &#39;Bob&#39;],\n    &#39;info&#39;: [{&#39;age&#39;: 25}, {&#39;age&#39;: 30}]\n}\n<\/code><\/pre>\n<p>\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c<code>mixed_dict<\/code>\u5305\u542b\u4e86\u4e0d\u540c\u7c7b\u578b\u7684\u6570\u636e\uff0c\u5c55\u793a\u4e86Python\u7075\u6d3b\u7684\u6570\u636e\u7ed3\u6784\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python3\u4e2d\u521b\u5efa\u4e00\u4e2a\u5b58\u50a8\u5217\u8868\u7684\u5b57\u5178\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528\u5927\u62ec\u53f7\u3001\u5b57\u5178\u63a8\u5bfc\u5f0f\u3001\u5185\u7f6e\u51fd\u6570dict() [&hellip;]","protected":false},"author":3,"featured_media":1136009,"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\/1136006"}],"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=1136006"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1136006\/revisions"}],"predecessor-version":[{"id":1136014,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1136006\/revisions\/1136014"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1136009"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1136006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1136006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1136006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}