{"id":38171,"date":"2025-05-20T01:04:03","date_gmt":"2025-05-19T17:04:03","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/38171.html"},"modified":"2025-05-20T01:04:03","modified_gmt":"2025-05-19T17:04:03","slug":"python%e6%89%93%e5%8d%a1day16","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/38171.html","title":{"rendered":"python\u6253\u5361day16"},"content":{"rendered":"<p style=\"margin-left:0;margin-right:0;text-align:justify\">NumPy \u6570\u7ec4\u57fa\u7840<\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:justify\"><span style=\"color:#333333\">\u56e0\u4e3a\u524d\u5929\u8bf4\u4e86shap&#xff0c;\u8fd9\u91cc\u6d89\u53ca\u5230\u6570\u636e\u5f62\u72b6\u5c3a\u5bf8\u95ee\u9898&#xff0c;\u6240\u4ee5\u9700\u8981\u5728\u8fd9\u4e00\u8282\u8bf4\u6e05\u695a&#xff0c;\u540e\u7eed\u7684\u795e\u7ecf\u7f51\u7edc\u6211\u4eec\u5c06\u8981\u548c\u4ed6\u5929\u5929\u6253\u4ea4\u9053\u3002<\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:justify\"><span style=\"color:#333333\">\u77e5\u8bc6\u70b9&#xff1a;<\/span><\/p>\n<li style=\"text-align:justify\"><span style=\"color:#333333\">numpy\u6570\u7ec4\u7684\u521b\u5efa&#xff1a;\u7b80\u5355\u521b\u5efa\u3001\u968f\u673a\u521b\u5efa\u3001\u904d\u5386\u3001\u8fd0\u7b97<\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"color:#333333\">numpy\u6570\u7ec4\u7684\u7d22\u5f15&#xff1a;\u4e00\u7ef4\u3001\u4e8c\u7ef4\u3001\u4e09\u7ef4<\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"color:#333333\">SHAP\u503c\u7684\u6df1\u5165\u7406\u89e3<\/span><\/li>\n<p style=\"margin-left:0;margin-right:0;text-align:justify\"><span style=\"background-color:#ffff00\"><span style=\"color:#333333\">\u4f5c\u4e1a<\/span><\/span><span style=\"color:#333333\">&#xff1a;\u4eca\u65e5\u77e5\u8bc6\u70b9\u6bd4\u8f83\u591a&#xff0c;\u597d\u597d\u8bb0\u5fc6\u4e0b<\/span><\/p>\n<p>1. \u7406\u89e3\u6570\u7ec4\u7684\u7ef4\u5ea6 (Dimensions)<\/p>\n<p>NumPy \u6570\u7ec4\u7684\u7ef4\u5ea6\u6216\u79f0\u4e3a\u8f74 (Axis)\u7684\u6982\u5ff5&#xff0c;\u4e0e\u6211\u4eec\u65e5\u5e38\u7406\u89e3\u7684\u7ef4\u5ea6\u975e\u5e38\u76f8\u4f3c\u3002\u76f4\u89c2\u5224\u65ad&#xff1a;\u6570\u7ec4\u7684\u7ef4\u5ea6\u5c42\u6570\u901a\u5e38\u53ef\u4ee5\u901a\u8fc7\u6253\u5370\u8f93\u51fa\u65f6\u4e2d\u62ec\u53f7 &#096;[]&#096; \u7684\u5d4c\u5957\u5c42\u6570\u6765\u521d\u6b65\u786e\u5b9a&#xff1a;<\/p>\n<p>\u00a0\u4e00\u5c42 &#096;[]&#096;&#xff1a;\u4e00\u7ef4\u6570\u7ec4\u3002\u4e24\u5c42 &#096;[]&#096;&#xff1a;\u4e8c\u7ef4\u6570\u7ec4\u3002\u4e09\u5c42 &#096;[]&#096;&#xff1a;\u4e09\u7ef4\u6570\u7ec4&#xff0c;\u4f9d\u6b64\u7c7b\u63a8\u3002<\/p>\n<p>2. NumPy \u6570\u7ec4\u4e0e\u6df1\u5ea6\u5b66\u4e60 Tensor \u7684\u5173\u7cfb<\/p>\n<p>\u5728\u540e\u7eed\u8fdb\u884c\u9891\u7e41\u7684\u6570\u5b66\u8fd0\u7b97\u65f6&#xff0c;\u5c24\u5176\u662f\u5728\u6df1\u5ea6\u5b66\u4e60\u9886\u57df&#xff0c;\u5bf9 NumPy \u6570\u7ec4\u7684\u7406\u89e3\u975e\u5e38\u6709\u5e2e\u52a9&#xff0c;\u56e0\u4e3a PyTorch \u6216 TensorFlow \u4e2d\u7684Tensor\u5f20\u91cf\u672c\u8d28\u4e0a\u53ef\u4ee5\u89c6\u4e3a\u652f\u6301 GPU \u52a0\u901f\u548c\u81ea\u52a8\u5fae\u5206\u7684 NumPy \u6570\u7ec4\u3002\u638c\u63e1 NumPy \u7684\u57fa\u672c\u64cd\u4f5c&#xff0c;\u80fd\u6781\u5927\u5730\u964d\u4f4e\u5b66\u4e60 Tensor \u7684\u95e8\u69db\u3002\u5173\u4e8e NumPy \u66f4\u6df1\u5165\u7684\u6027\u8d28&#xff0c;\u6211\u4eec\u7559\u5f85\u540e\u7eed\u63a2\u8ba8\u3002<\/p>\n<p>3. \u4e00\u7ef4\u6570\u7ec4 (1D Array)<\/p>\n<p>\u4e00\u7ef4\u6570\u7ec4\u5728\u7ed3\u6784\u4e0a\u4e0e Python \u4e2d\u7684\u5217\u8868&#xff08;List&#xff09;\u975e\u5e38\u76f8\u4f3c\u3002\u5b83\u4eec\u7684\u4e3b\u8981\u533a\u522b\u5728\u4e8e&#xff1a;<\/p>\n<p>\u6253\u5370\u8f93\u51fa\u683c\u5f0f&#xff1a; \u5f53\u4f7f\u7528 &#096;print()&#096; \u51fd\u6570\u8f93\u51fa\u65f6&#xff1a;NumPy \u4e00\u7ef4\u6570\u7ec4\u7684\u5143\u7d20\u4e4b\u95f4\u9ed8\u8ba4\u4f7f\u7528\u7a7a\u683c\u5206\u9694\u3002Python \u5217\u8868\u7684\u5143\u7d20\u4e4b\u95f4\u4f7f\u7528\u9017\u53f7\u5206\u9694\u3002<\/p>\n<p> # \u5206\u6e05\u695a\u5217\u8868\u548c\u6570\u7ec4\u7684\u533a\u522b<br \/>\nprint([7, 5, 3, 9])  # \u8f93\u51fa: [7, 5, 3, 9]&#xff08;\u9017\u53f7\u5206\u9694&#xff09;<br \/>\nprint(np.array([7, 5, 3, 9]))  # \u8f93\u51fa: [7 5 3 9]&#xff08;\u7a7a\u683c\u5206\u9694&#xff09; <\/p>\n<p>\u00a04. \u4e8c\u7ef4\u6570\u7ec4 (2D Array)<\/p>\n<p>\u4e8c\u7ef4\u6570\u7ec4\u53ef\u4ee5\u88ab\u770b\u4f5c\u662f\u201c\u6570\u7ec4\u7684\u6570\u7ec4\u201d\u6216\u8005\u4e00\u4e2a\u77e9\u9635\u3002\u5176\u7ed3\u6784\u7531\u4e24\u4e2a\u4e3b\u8981\u7ef4\u5ea6\u51b3\u5b9a&#xff1a;<\/p>\n<ul>\n<li>\u884c\u6570&#xff1a;\u4ee3\u8868\u6574\u4e2a\u4e8c\u7ef4\u6570\u7ec4\u4e2d\u5305\u542b\u591a\u5c11\u4e2a\u4e00\u7ef4\u6570\u7ec4\u3002<\/li>\n<li>\u5217\u6570&#xff1a;\u4ee3\u8868\u6bcf\u4e2a\u4e00\u7ef4\u6570\u7ec4&#xff08;\u4e5f\u5c31\u662f\u6bcf\u4e00\u884c&#xff09;\u4e2d\u5305\u542b\u591a\u5c11\u4e2a\u5143\u7d20\u3002<\/li>\n<\/ul>\n<p>\u503c\u5f97\u6ce8\u610f\u7684\u662f&#xff0c;\u4e8c\u7ef4\u6570\u7ec4\u4e0d\u4e00\u5b9a\u662f\u6b63\u65b9\u5f62&#xff08;\u5373\u884c\u6570\u7b49\u4e8e\u5217\u6570&#xff09;&#xff0c;\u5b83\u53ef\u4ee5\u662f\u4efb\u610f\u7684 &#096;n * m&#096; \u5f62\u72b6&#xff0c;\u5176\u4e2d &#096;n&#096; \u662f\u884c\u6570&#xff0c;&#096;m&#096; \u662f\u5217\u6570\u3002<\/p>\n<p>\u00a05. \u6570\u7ec4\u7684\u521b\u5efa<\/p>\n<p>NumPy \u7684 &#096;array()&#096; \u51fd\u6570\u975e\u5e38\u7075\u6d3b&#xff0c;\u53ef\u4ee5\u63a5\u53d7\u5404\u79cd\u201c\u5e8f\u5217\u578b\u201d\u5bf9\u8c61\u4f5c\u4e3a\u8f93\u5165\u53c2\u6570\u6765\u521b\u5efa\u6570\u7ec4\u3002\u8fd9\u610f\u5473\u7740\u4f60\u53ef\u4ee5\u5c06 Python \u7684\u5217\u8868 (List)\u3001\u5143\u7ec4 (Tuple)&#xff0c;\u751a\u81f3\u5176\u4ed6\u7684 NumPy \u6570\u7ec4\u7b49\u6570\u636e\u7ed3\u6784\u76f4\u63a5\u4f20\u9012\u7ed9 &#096;np.array()&#096; \u6765\u521b\u5efa\u65b0\u7684 NumPy \u6570\u7ec4\u3002<\/p>\n<h4>\u4e00\u3001\u7b80\u5355\u8d4b\u503c\u521b\u5efa<\/h4>\n<p> import numpy as np<br \/>\na &#061; np.array([2,4,6,8,10,12]) # \u521b\u5efa\u4e00\u4e2a\u4e00\u7ef4\u6570\u7ec4<br \/>\nb &#061; np.array([[2,4,6],[8,10,12]]) # \u521b\u5efa\u4e00\u4e2a\u4e8c\u7ef4\u6570\u7ec4<br \/>\nprint(a)<br \/>\nprint(b)<\/p>\n<p># &#8212;&#8212; \u4ee5\u4e0b\u662f\u7ed3\u679c &#8212;&#8212;-<br \/>\n[ 2  4  6  8 10 12]<br \/>\n[[ 2  4  6]<br \/>\n [ 8 10 12]] <\/p>\n<p>\u6700\u91cd\u8981\u7684\u662f\u6570\u7ec4\u7684\u5f62\u72b6\u8981\u641e\u6e05\u695a<\/p>\n<p> a.shape # \u7ed3\u679c\u662f(6,)&#xff0c;1\u4e2a\u6570\u5b57\u8868\u793a1\u7ef4<br \/>\nb.shape # \u7ed3\u679c\u662f(2, 3)&#xff0c;2\u4e2a\u6570\u5b57\u8868\u793a2\u7ef4 <\/p>\n<p>\u533a\u5206\u4e00\u4e0b\u4e00\u7ef4\u6570\u7ec4&#xff08;6&#xff0c;&#xff09;\u548c\u4e8c\u7ef4\u6570\u7ec4&#xff08;1&#xff0c;6&#xff09;\u3001&#xff08;6&#xff0c;1&#xff09;<\/p>\n<p> # \u4e00\u7ef4\u6570\u7ec4 (6,)<br \/>\na &#061; np.array([1,2,3,4,5,6])<br \/>\n# \u4e8c\u7ef4\u6570\u7ec4 (1,6)<br \/>\nb &#061; np.array([[1,2,3,4,5,6]])<br \/>\n# \u4e8c\u7ef4\u6570\u7ec4 (6,1)<br \/>\nc &#061; np.array([[1],[2],[3],[4],[5],[6]]) <\/p>\n<h4>\u4e8c\u3001\u5168\u96f6\u6570\u7ec4\u3001\u5168\u4e00\u6570\u7ec4\u3001\u987a\u5e8f\u6570\u7ec4<\/h4>\n<p> zeros &#061; np.zeros((2, 3)) # \u521b\u5efa\u4e00\u4e2a2\u884c3\u5217\u7684\u5168\u96f6\u77e9\u9635<br \/>\nzeros<br \/>\n# &#8212;&#8212;&#8211; \u4ee5\u4e0b\u662f\u8f93\u51fa\u7ed3\u679c &#8212;&#8212;&#8211;<br \/>\narray([[0., 0., 0.],<br \/>\n       [0., 0., 0.]])<\/p>\n<p>ones &#061; np.ones((3,))  # \u521b\u5efa\u4e00\u4e2a\u5f62\u72b6\u4e3a(3,)\u7684\u51681\u6570\u7ec4<br \/>\nones<br \/>\n# &#8212;&#8212;&#8211; \u4ee5\u4e0b\u662f\u8f93\u51fa\u7ed3\u679c &#8212;&#8212;&#8211;<br \/>\narray([1., 1., 1.])<\/p>\n<p>arange &#061; np.arange(1, 10) # \u521b\u5efa\u4e00\u4e2a\u4ece1\u523010\u7684\u6570\u7ec4<br \/>\narange<br \/>\n# &#8212;&#8212;&#8211; \u4ee5\u4e0b\u662f\u8f93\u51fa\u7ed3\u679c &#8212;&#8212;&#8211;<br \/>\narray([1, 2, 3, 4, 5, 6, 7, 8, 9]) <\/p>\n<p>1. \u662f\u6d6e\u70b9\u6570(float)\u7684\u7b80\u5199\u5f62\u5f0f\u7b49\u4ef7\u4e8e 1.0&#xff0c;\u8868\u793a\u8fd9\u662f\u4e00\u4e2a\u6d6e\u70b9\u6570\u800c\u975e\u6574\u6570&#xff0c;NumPy\u7684 ones()\/zeros() \u7b49\u51fd\u6570\u9ed8\u8ba4\u4f1a\u521b\u5efa\u6d6e\u70b9\u578b\u6570\u7ec4&#xff0c;\u8fd9\u662f\u79d1\u5b66\u8ba1\u7b97\u7684\u5e38\u89c1\u9700\u6c42&#xff1b;arange()\u9ed8\u8ba4\u521b\u5efa\u6574\u6570\u578b\u6570\u7ec4&#xff0c;\u8bbe\u8ba1\u7528\u4e8e\u751f\u6210\u5e8f\u5217&#xff0c;\u5e38\u7528\u4e8e\u7d22\u5f15\u7b49\u6574\u6570\u573a\u666f&#xff0c;<span style=\"color:#fe2c24\">np.arange()\u00a0\u53ea\u80fd\u76f4\u63a5\u521b\u5efa\u4e00\u7ef4\u6570\u7ec4&#xff0c;\u4f46\u901a\u8fc7reshape\u7b49\u540e\u7eed\u64cd\u4f5c\u53ef\u81ea\u7531\u8f6c\u6362\u7ef4\u5ea6&#xff0c;\u5e38\u7528\u4e8e\u521b\u5efa\u4e8c\u7ef4\u6570\u7ec4\u548c\u4e09\u7ef4\u6570\u7ec4<\/span><\/p>\n<p> arr3d &#061; np.arange(3 * 4 * 5).reshape((3, 4, 5))<br \/>\n# \u751f\u6210\u4ece0-59\u7684\u8fde\u7eed\u4e00\u7ef4\u6570\u7ec4&#xff0c;\u518d\u91cd\u5851\u4e3a3\u00d74\u00d75\u7684\u4e09\u7ef4\u6570\u7ec4(\u5c42\u6570, \u884c\u6570, \u5217\u6570)<\/p>\n<p># &#8212;&#8212;&#8212;- \u4ee5\u4e0b\u4e3a\u7ed3\u679c &#8212;&#8212;&#8212;&#8211;<br \/>\narray([<br \/>\n    # \u7b2c0\u5c42 (shape: 4&#215;5)<br \/>\n    [[ 0,  1,  2,  3,  4],<br \/>\n     [ 5,  6,  7,  8,  9],<br \/>\n     [10, 11, 12, 13, 14],<br \/>\n     [15, 16, 17, 18, 19]],<\/p>\n<p>    # \u7b2c1\u5c42<br \/>\n    [[20, 21, 22, 23, 24],<br \/>\n     [25, 26, 27, 28, 29],<br \/>\n     [30, 31, 32, 33, 34],<br \/>\n     [35, 36, 37, 38, 39]],<\/p>\n<p>    # \u7b2c2\u5c42<br \/>\n    [[40, 41, 42, 43, 44],<br \/>\n     [45, 46, 47, 48, 49],<br \/>\n     [50, 51, 52, 53, 54],<br \/>\n     [55, 56, 57, 58, 59]]<br \/>\n]) <\/p>\n<h4>\u4e09\u3001\u968f\u673a\u521b\u5efa\u6570\u7ec4<\/h4>\n<p>1. \u5728\u540e\u7eed\u6df1\u5ea6\u5b66\u4e60\u4e2d&#xff0c;\u6211\u4eec\u7ecf\u5e38\u9700\u8981\u5bf9\u6570\u636e\u8fdb\u884c\u968f\u673a\u5316\u5904\u7406&#xff0c;\u4ee5\u786e\u4fdd\u6a21\u578b\u7684\u6cdb\u5316\u80fd\u529b\u3002<\/p>\n<p>2. \u4e3a\u4e86\u6d4b\u8bd5\u5f88\u591a\u51fd\u6570\u7684\u6027\u80fd&#xff0c;\u5f80\u5f80\u9700\u8981\u968f\u673a\u5316\u751f\u6210\u5f88\u591a\u6570\u636e\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"444\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250519170401-682b6481e59bc.png\" width=\"1190\" \/><\/p>\n<p>&#8211; \u8bb0\u5fc6\u6280\u5de7&#xff1a;<\/p>\n<p>1. \u770b\u7ed3\u5c3e&#xff1a;<\/p>\n<p>\u00a0 \u00a0&#8211; &#034;int&#034; \u2192 \u6574\u6570<\/p>\n<p>\u00a0 \u00a0&#8211; &#034;n&#034; \u2192 \u6b63\u6001(normal)<\/p>\n<p>2. \u770b\u524d\u7f00&#xff1a;<\/p>\n<p>\u00a0 \u00a0&#8211; \u7eaf&#034;random&#034; \u2192 Python\u57fa\u7840\u968f\u673a<\/p>\n<p>\u00a0 \u00a0&#8211; &#034;np.random&#034; \u2192 NumPy\u589e\u5f3a\u7248<\/p>\n<p>3. \u529f\u80fd\u5dee\u5f02&#xff1a;<\/p>\n<p>\u00a0 \u00a0&#8211; &#096;rand()&#096;\u548c&#096;random()&#096;\u90fd\u662f\u5747\u5300\u5206\u5e03&#xff0c;\u4f46&#096;rand()&#096;\u80fd\u76f4\u63a5\u751f\u6210\u6570\u7ec4<\/p>\n<p>\u00a0 \u00a0&#8211; &#096;randn()&#096;\u751f\u6210\u7684\u6570\u636e\u4f1a\u6709\u6b63\u6709\u8d1f&#xff0c;\u5176\u4ed6\u65b9\u6cd5\u90fd\u662f\u975e\u8d1f\u6570<\/p>\n<p>\u6765\u5e94\u7528\u4e00\u4e0b&#xff1a;<\/p>\n<p> import numpy as np<br \/>\nnp.random.seed(42)  # \u8bbe\u7f6e\u968f\u673a\u79cd\u5b50\u4ee5\u786e\u4fdd\u7ed3\u679c\u53ef\u91cd\u590d<\/p>\n<p># \u751f\u621010\u4e2a\u8bed\u6587\u6210\u7ee9&#xff08;\u6b63\u6001\u5206\u5e03&#xff0c;\u5747\u503c75&#xff0c;\u6807\u51c6\u5dee10&#xff09;<br \/>\nchinese_scores &#061; np.random.normal(75, 10, 10).round(1)<br \/>\n# \u7b2c\u4e00\u4e2a\u53c2\u657075\u4e3a\u5747\u503c\u3002\u7b2c\u4e8c\u4e2a\u53c2\u657010\u4e3a\u6807\u51c6\u5dee&#xff0c;\u7b2c\u4e09\u4e2a\u53c2\u657010\u4e3a\u6570\u7ec4\u5927\u5c0f<br \/>\n# .normal() \u751f\u6210\u539f\u59cb\u968f\u673a\u6570&#xff08;\u53ef\u80fd\u542b\u591a\u4f4d\u5c0f\u6570&#xff09;   .round(1) \u5c06\u7ed3\u679c\u56db\u820d\u4e94\u5165\u4fdd\u75591\u4f4d\u5c0f\u6570<\/p>\n<p># \u627e\u51fa\u6700\u9ad8\u5206\u548c\u6700\u4f4e\u5206\u53ca\u5176\u7d22\u5f15<br \/>\nmax_score &#061; np.max(chinese_scores)<br \/>\nmax_index &#061; np.argmax(chinese_scores)<br \/>\nmin_score &#061; np.min(chinese_scores)<br \/>\nmin_index &#061; np.argmin(chinese_scores)<\/p>\n<p>print(f&#034;\u6240\u6709\u6210\u7ee9: {chinese_scores}&#034;)<br \/>\nprint(f&#034;\u6700\u9ad8\u5206: {max_score} (\u7b2c{max_index}\u4e2a\u5b66\u751f)&#034;)<br \/>\nprint(f&#034;\u6700\u4f4e\u5206: {min_score} (\u7b2c{min_index}\u4e2a\u5b66\u751f)&#034;)<\/p>\n<p># &#8212;&#8212;&#8212;- \u4ee5\u4e0b\u4e3a\u7ed3\u679c &#8212;&#8212;&#8212;-<br \/>\n\u6240\u6709\u6210\u7ee9: [80.  73.6 81.5 90.2 72.7 72.7 90.8 82.7 70.3 80.4]<br \/>\n\u6700\u9ad8\u5206: 90.8 (\u7b2c6\u4e2a\u5b66\u751f)<br \/>\n\u6700\u4f4e\u5206: 70.3 (\u7b2c8\u4e2a\u5b66\u751f) <\/p>\n<h4>\u56db\u3001\u6570\u7ec4\u7684\u8fd0\u7b97<\/h4>\n<p>\u5f88\u7b80\u5355&#xff0c;\u5168\u90e8\u53c2\u8003\u7ebf\u4ee3\u7684\u77e9\u9635\u8ba1\u7b97\u89c4\u5219\u5373\u53ef&#xff0c;\u4f46\u6ce8\u610f\u76f4\u63a5\u7528&#039; * &#039;\u3001&#039; \/ &#039;\u7b26\u53f7\u8fdb\u884c\u7684\u662f\u9010\u5143\u7d20\u4e58\u9664\u6cd5&#xff0c;\u77e9\u9635\u4e58\u6cd5\u662f&#039; &#064; &#039;\u8fd0\u7b97\u7b26&#xff0c;\u77e9\u9635\u9664\u6cd5\u8981\u5148\u6c42\u9006\u518d\u77e9\u9635\u4e58\u6cd5&#xff0c;\u5c31\u662f\u6ce8\u610f\u4e00\u4e0b NumPy \u7684\u00a0*\u00a0\u76f8\u5f53\u4e8eMATLAB\u7684\u00a0.*&#xff0c;\u800c\u00a0&#064;\u00a0\u76f8\u5f53\u4e8eMATLAB\u7684\u00a0*<\/p>\n<h4>\u4e94\u3001\u6570\u7ec4\u7684\u7d22\u5f15<\/h4>\n<p><span style=\"color:#0d0016\"><span style=\"background-color:#c7e6ea\">1.\u4e00\u7ef4\u6570\u7ec4<\/span><\/span><\/p>\n<p>\u5bf9\u4e8e\u4e00\u7ef4\u6570\u7ec4\u53d6\u4e00\u4e2a\u5143\u7d20\u7684\u7d22\u5f15\u6765\u8bf4&#xff0c;\u8ddf\u5217\u8868\u5dee\u4e0d\u591a<\/p>\n<p><span style=\"background-color:#ffd900\">\u6574\u6570\u6570\u7ec4\u8fdb\u884c\u7d22\u5f15<\/span>\u4e00\u6b21\u6027\u53d6\u591a\u4e2a\u5143\u7d20&#xff1a;\u8bed\u6cd5\u662f arr1d[[index1, index2, &#8230;]]<\/p>\n<p> arr1d[[3, 5, 8]] # \u53d6\u51fa\u6570\u7ec4\u4e2d\u7d22\u5f15\u4e3a 3, 5, 8 \u7684\u5143\u7d20 <\/p>\n<p><span style=\"background-color:#ffd900\">\u5207\u7247\u8fdb\u884c\u7d22\u5f15<\/span>\u4e00\u6b21\u6027\u53d6\u591a\u4e2a\u5143\u7d20&#xff1a;\u8bed\u6cd5\u662f arr1d[start : stop]&#xff0c;\u5047\u5982\u6b65\u957f\u60f3\u8981\u81ea\u5df1\u8bbe\u7f6e<\/p>\n<p>arr1d[start : stop : step]<\/p>\n<p> arr1d[2:6] # \u53d6\u51fa\u7d22\u5f15\u4e3a2\u52305\u7684\u5143\u7d20&#xff08;\u4e0d\u5305\u62ec\u7d22\u5f156\u7684\u5143\u7d20&#xff0c;\u53d6\u5de6\u4e0d\u53d6\u53f3&#xff09;<\/p>\n<p>arr1d[:5] # \u53d6\u51fa\u6570\u7ec4\u4e2d\u4ece\u5934\u5230\u7d22\u5f15 5 (\u4e0d\u5305\u542b 5) \u7684\u5143\u7d20<\/p>\n<p>arr1d[4:] # \u53d6\u51fa\u6570\u7ec4\u4e2d\u4ece\u7d22\u5f15 4 \u5230\u7ed3\u5c3e\u7684\u5143\u7d20<\/p>\n<p>arr1d[:] # \u53d6\u51fa\u5168\u90e8\u5143\u7d20<\/p>\n<p>arr1d[::2] # \u53d6\u51fa\u6570\u7ec4\u4e2d\u6240\u6709\u5076\u6570\u7d22\u5f15\u5bf9\u5e94\u7684\u5143\u7d20 (\u5373\u7d22\u5f15 0, 2, 4, 6, &#8230;) <\/p>\n<p><span style=\"background-color:#cbe0f1\">2.\u4e8c\u7ef4\u6570\u7ec4<\/span><\/p>\n<p>\u7d22\u5f15\u987a\u5e8f&#xff1a;\u5728\u4e8c\u7ef4\u6570\u7ec4 arr2d \u91cc&#xff0c;\u7b2c\u4e00\u4e2a\u7d22\u5f15\u503c\u4ee3\u8868\u884c&#xff0c;\u7b2c\u4e8c\u4e2a\u7d22\u5f15\u503c\u4ee3\u8868\u5217\u3002\u6bd4\u5982 arr2d[i ,\u00a0j] &#xff0c;i \u662f\u884c\u7d22\u5f15&#xff0c;j \u662f\u5217\u7d22\u5f15<\/p>\n<p> arr2d[1, :] # \u53d6\u51fa\u7b2c 2 \u884c (\u7d22\u5f15\u4e3a 1) \u7684\u6240\u6709\u5143\u7d20&#xff0c;\u4e5f\u53ef\u4ee5\u7701\u7565\u540e\u9762\u7684:\u6210arr2d[1]<\/p>\n<p>arr2d[:, 2] # \u53d6\u51fa\u7b2c 3 \u5217 (\u7d22\u5f15\u4e3a 2) \u7684\u6240\u6709\u5143\u7d20<\/p>\n<p>arr2d[[0, 2], :] # \u4f7f\u7528\u6574\u6570\u6570\u7ec4\u4f5c\u4e3a\u884c\u7d22\u5f15&#xff0c;\u53d6\u51fa\u7531\u7b2c 1 \u884c\u548c\u7b2c 3 \u884c\u7684\u5143\u7d20<\/p>\n<p>arr2d[:, [1, 3]] # \u4f7f\u7528\u6574\u6570\u6570\u7ec4\u4f5c\u4e3a\u5217\u7d22\u5f15&#xff0c;\u53d6\u51fa\u7531\u7b2c 2 \u5217\u548c\u7b2c 4 \u5217\u7684\u5143\u7d20<\/p>\n<p>arr2d[1:3, 1:3] # \u4f7f\u7528\u5207\u7247\u4f5c\u4e3a\u7d22\u5f15&#xff0c;\u53d6\u51fa\u4e00\u4e2a 2&#215;2 \u7684\u5b50\u77e9\u9635 <\/p>\n<p><span style=\"background-color:#cbe0f1\">3.\u4e09\u7ef4\u6570\u7ec4<\/span><\/p>\n<p><span style=\"background-color:null\">\u548c\u4e8c\u7ef4\u6570\u7ec4\u7684\u7d22\u5f15\u5dee\u4e0d\u591a<\/span><\/p>\n<p> arr3d &#061; np.arange(3 * 4 * 5).reshape((3, 4, 5))<br \/>\n# \u751f\u6210\u4ece0-59\u7684\u8fde\u7eed\u4e00\u7ef4\u6570\u7ec4&#xff0c;\u518d\u91cd\u5851\u4e3a3\u00d74\u00d75\u7684\u4e09\u7ef4\u6570\u7ec4(\u5c42\u6570, \u884c\u6570, \u5217\u6570)<\/p>\n<p># &#8212;&#8212;&#8212;- \u4ee5\u4e0b\u4e3a\u7ed3\u679c &#8212;&#8212;&#8212;&#8211;<br \/>\narray([<br \/>\n    # \u7b2c0\u5c42 (shape: 4&#215;5)<br \/>\n    [[ 0,  1,  2,  3,  4],<br \/>\n     [ 5,  6,  7,  8,  9],<br \/>\n     [10, 11, 12, 13, 14],<br \/>\n     [15, 16, 17, 18, 19]],<\/p>\n<p>    # \u7b2c1\u5c42<br \/>\n    [[20, 21, 22, 23, 24],<br \/>\n     [25, 26, 27, 28, 29],<br \/>\n     [30, 31, 32, 33, 34],<br \/>\n     [35, 36, 37, 38, 39]],<\/p>\n<p>    # \u7b2c2\u5c42<br \/>\n    [[40, 41, 42, 43, 44],<br \/>\n     [45, 46, 47, 48, 49],<br \/>\n     [50, 51, 52, 53, 54],<br \/>\n     [55, 56, 57, 58, 59]]<br \/>\n])<\/p>\n<p>arr3d[1, :, :] # \u9009\u62e9\u7b2c\u4e8c\u5c42<br \/>\n# &#8212;&#8212;&#8212; \u4ee5\u4e0b\u4e3a\u7ed3\u679c &#8212;&#8212;&#8212;&#8211;<br \/>\narray([[20, 21, 22, 23, 24],<br \/>\n       [25, 26, 27, 28, 29],<br \/>\n       [30, 31, 32, 33, 34],<br \/>\n       [35, 36, 37, 38, 39]])<\/p>\n<p>arr3d[1, 0:2, :]# \u4f7f\u7528\u6574\u6570\u6570\u7ec4 [0, 2] \u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u7ef4\u5ea6 (\u5c42) \u7684\u7d22\u5f15<br \/>\n# &#8212;&#8212;&#8212; \u4ee5\u4e0b\u4e3a\u7ed3\u679c &#8212;&#8212;&#8212;&#8211;<br \/>\narray([[20, 21, 22, 23, 24],<br \/>\n       [25, 26, 27, 28, 29]])<\/p>\n<p>arr3d[1, 0:2, 2:4]<br \/>\n# &#8212;&#8212;&#8212; \u4ee5\u4e0b\u4e3a\u7ed3\u679c &#8212;&#8212;&#8212;&#8211;<br \/>\narray([[22, 23],<br \/>\n       [27, 28]])<\/p>\n<p>\u6536\u83b7\u5fc3\u5f97&#xff1a;<\/p>\n<p>\u5b66\u5b8c\u4e86\u518d\u8c03\u8f6c\u56de\u53bb\u770b\u770bshap\u5e93\u90a3\u4e00\u8282\u7684shap_values\u7684\u7d22\u5f15&#xff0c;\u5e94\u8be5\u5c31\u80fd\u641e\u61c2\u4e86<\/p>\n<p>&#064;\u6d59\u5927\u758f\u9526\u884c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.3k\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u56e0\u4e3a\u524d\u5929\u8bf4\u4e86shap\uff0c\u8fd9\u91cc\u6d89\u53ca\u5230\u6570\u636e\u5f62\u72b6\u5c3a\u5bf8\u95ee\u9898\uff0c\u6240\u4ee5\u9700\u8981\u5728\u8fd9\u4e00\u8282\u8bf4\u6e05\u695a\uff0c\u540e\u7eed\u7684\u795e\u7ecf\u7f51\u7edc\u6211\u4eec\u5c06\u8981\u548c\u4ed6\u5929\u5929\u6253\u4ea4\u9053\u3002\u77e5\u8bc6\u70b9\uff1anumpy\u6570\u7ec4\u7684\u521b\u5efa\uff1a\u7b80\u5355\u521b\u5efa\u3001\u968f\u673a\u521b\u5efa\u3001\u904d\u5386\u3001\u8fd0\u7b97numpy\u6570\u7ec4\u7684\u7d22\u5f15\uff1a\u4e00\u7ef4\u3001\u4e8c\u7ef4\u3001\u4e09\u7ef4SHAP\u503c\u7684\u6df1\u5165\u7406\u89e3\u4f5c\u4e1a\uff1a\u4eca\u65e5\u77e5\u8bc6\u70b9\u6bd4\u8f83\u591a\uff0c\u597d\u597d\u8bb0\u5fc6\u4e0bNumPy \u6570\u7ec4\u7684\u7ef4\u5ea6\u6216\u79f0\u4e3a\u8f74 (Axis)\u7684\u6982\u5ff5\uff0c\u4e0e\u6211\u4eec\u65e5\u5e38\u7406\u89e3\u7684\u7ef4\u5ea6\u975e\u5e38\u76f8\u4f3c\u3002\u76f4\u89c2\u5224\u65ad\uff1a\u6570\u7ec4\u7684\u7ef4\u5ea6\u5c42\u6570\u901a\u5e38\u53ef\u4ee5\u901a\u8fc7\u6253\u5370\u8f93\u51fa\u65f6\u4e2d\u62ec\u53f7 `[]` \u7684\u5d4c\u5957\u5c42\u6570\u6765\u521d\u6b65\u786e\u5b9a\uff1a\u4e00\u5c42 `[]`\uff1a\u4e00\u7ef4\u6570\u7ec4\u3002\u4e24\u5c42 `[]`\uff1a\u4e8c\u7ef4\u6570\u7ec4\u3002_python\u51e0\u7ef4\u6570\u7ec4\u600e\u4e48\u5224\u65ad<\/p>\n","protected":false},"author":2,"featured_media":38170,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[81,3319,190],"topic":[],"class_list":["post-38171","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-python","tag-python-","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>python\u6253\u5361day16 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/38171.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"python\u6253\u5361day16 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.3k\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u56e0\u4e3a\u524d\u5929\u8bf4\u4e86shap\uff0c\u8fd9\u91cc\u6d89\u53ca\u5230\u6570\u636e\u5f62\u72b6\u5c3a\u5bf8\u95ee\u9898\uff0c\u6240\u4ee5\u9700\u8981\u5728\u8fd9\u4e00\u8282\u8bf4\u6e05\u695a\uff0c\u540e\u7eed\u7684\u795e\u7ecf\u7f51\u7edc\u6211\u4eec\u5c06\u8981\u548c\u4ed6\u5929\u5929\u6253\u4ea4\u9053\u3002\u77e5\u8bc6\u70b9\uff1anumpy\u6570\u7ec4\u7684\u521b\u5efa\uff1a\u7b80\u5355\u521b\u5efa\u3001\u968f\u673a\u521b\u5efa\u3001\u904d\u5386\u3001\u8fd0\u7b97numpy\u6570\u7ec4\u7684\u7d22\u5f15\uff1a\u4e00\u7ef4\u3001\u4e8c\u7ef4\u3001\u4e09\u7ef4SHAP\u503c\u7684\u6df1\u5165\u7406\u89e3\u4f5c\u4e1a\uff1a\u4eca\u65e5\u77e5\u8bc6\u70b9\u6bd4\u8f83\u591a\uff0c\u597d\u597d\u8bb0\u5fc6\u4e0bNumPy \u6570\u7ec4\u7684\u7ef4\u5ea6\u6216\u79f0\u4e3a\u8f74 (Axis)\u7684\u6982\u5ff5\uff0c\u4e0e\u6211\u4eec\u65e5\u5e38\u7406\u89e3\u7684\u7ef4\u5ea6\u975e\u5e38\u76f8\u4f3c\u3002\u76f4\u89c2\u5224\u65ad\uff1a\u6570\u7ec4\u7684\u7ef4\u5ea6\u5c42\u6570\u901a\u5e38\u53ef\u4ee5\u901a\u8fc7\u6253\u5370\u8f93\u51fa\u65f6\u4e2d\u62ec\u53f7 `[]` \u7684\u5d4c\u5957\u5c42\u6570\u6765\u521d\u6b65\u786e\u5b9a\uff1a\u4e00\u5c42 `[]`\uff1a\u4e00\u7ef4\u6570\u7ec4\u3002\u4e24\u5c42 `[]`\uff1a\u4e8c\u7ef4\u6570\u7ec4\u3002_python\u51e0\u7ef4\u6570\u7ec4\u600e\u4e48\u5224\u65ad\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/38171.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-19T17:04:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250519170401-682b6481e59bc.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/38171.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/38171.html\",\"name\":\"python\u6253\u5361day16 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-05-19T17:04:03+00:00\",\"dateModified\":\"2025-05-19T17:04:03+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/38171.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/38171.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/38171.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"python\u6253\u5361day16\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"python\u6253\u5361day16 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/38171.html","og_locale":"zh_CN","og_type":"article","og_title":"python\u6253\u5361day16 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.3k\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u56e0\u4e3a\u524d\u5929\u8bf4\u4e86shap\uff0c\u8fd9\u91cc\u6d89\u53ca\u5230\u6570\u636e\u5f62\u72b6\u5c3a\u5bf8\u95ee\u9898\uff0c\u6240\u4ee5\u9700\u8981\u5728\u8fd9\u4e00\u8282\u8bf4\u6e05\u695a\uff0c\u540e\u7eed\u7684\u795e\u7ecf\u7f51\u7edc\u6211\u4eec\u5c06\u8981\u548c\u4ed6\u5929\u5929\u6253\u4ea4\u9053\u3002\u77e5\u8bc6\u70b9\uff1anumpy\u6570\u7ec4\u7684\u521b\u5efa\uff1a\u7b80\u5355\u521b\u5efa\u3001\u968f\u673a\u521b\u5efa\u3001\u904d\u5386\u3001\u8fd0\u7b97numpy\u6570\u7ec4\u7684\u7d22\u5f15\uff1a\u4e00\u7ef4\u3001\u4e8c\u7ef4\u3001\u4e09\u7ef4SHAP\u503c\u7684\u6df1\u5165\u7406\u89e3\u4f5c\u4e1a\uff1a\u4eca\u65e5\u77e5\u8bc6\u70b9\u6bd4\u8f83\u591a\uff0c\u597d\u597d\u8bb0\u5fc6\u4e0bNumPy \u6570\u7ec4\u7684\u7ef4\u5ea6\u6216\u79f0\u4e3a\u8f74 (Axis)\u7684\u6982\u5ff5\uff0c\u4e0e\u6211\u4eec\u65e5\u5e38\u7406\u89e3\u7684\u7ef4\u5ea6\u975e\u5e38\u76f8\u4f3c\u3002\u76f4\u89c2\u5224\u65ad\uff1a\u6570\u7ec4\u7684\u7ef4\u5ea6\u5c42\u6570\u901a\u5e38\u53ef\u4ee5\u901a\u8fc7\u6253\u5370\u8f93\u51fa\u65f6\u4e2d\u62ec\u53f7 `[]` \u7684\u5d4c\u5957\u5c42\u6570\u6765\u521d\u6b65\u786e\u5b9a\uff1a\u4e00\u5c42 `[]`\uff1a\u4e00\u7ef4\u6570\u7ec4\u3002\u4e24\u5c42 `[]`\uff1a\u4e8c\u7ef4\u6570\u7ec4\u3002_python\u51e0\u7ef4\u6570\u7ec4\u600e\u4e48\u5224\u65ad","og_url":"https:\/\/www.wsisp.com\/helps\/38171.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-05-19T17:04:03+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250519170401-682b6481e59bc.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/38171.html","url":"https:\/\/www.wsisp.com\/helps\/38171.html","name":"python\u6253\u5361day16 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-05-19T17:04:03+00:00","dateModified":"2025-05-19T17:04:03+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/38171.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/38171.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/38171.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"python\u6253\u5361day16"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/38171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=38171"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/38171\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/38170"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=38171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=38171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=38171"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=38171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}