{"id":205223,"date":"2025-05-29T09:57:59","date_gmt":"2025-05-29T01:57:59","guid":{"rendered":"https:\/\/server.hk\/cnblog\/205223\/"},"modified":"2025-05-29T09:57:59","modified_gmt":"2025-05-29T01:57:59","slug":"%e4%bd%bf%e7%94%a8-numpy-load-%e5%8a%a0%e8%bd%bd%e5%8c%85%e5%90%ab-none-%e5%80%bc%e7%9a%84%e6%95%b0%e7%bb%84%e6%97%b6%e5%a6%82%e4%bd%95%e9%81%bf%e5%85%8d%e6%8a%a5%e9%94%99%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/205223\/","title":{"rendered":"\u4f7f\u7528 numpy.load() \u52a0\u8f7d\u5305\u542b None \u503c\u7684\u6570\u7ec4\u65f6\u5982\u4f55\u907f\u514d\u62a5\u9519\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u4f7f\u7528 numpy.load() \u52a0\u8f7d\u5305\u542b None \u503c\u7684\u6570\u7ec4\u65f6\u5982\u4f55\u907f\u514d\u62a5\u9519\uff1f<\/h1>\n<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241126\/173260717667457cc88df72.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u89e3\u51b3 numpy.load() \u83b7\u53d6 none \u503c\u65f6\u62a5\u9519\u7684\u95ee\u9898<\/strong><\/p>\n<p>\u4f7f\u7528 numpy.load() \u52a0\u8f7d\u5305\u542b none \u503c\u7684\u6570\u7ec4\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u9519\u8bef\u3002\u8fd9\u662f\u56e0\u4e3a\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cnumpy.load() \u4e0d\u5141\u8bb8\u52a0\u8f7d\u5305\u542b python \u5bf9\u8c61\uff08\u5982 none\uff09\u7684\u6570\u7ec4\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p>\u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u8bf7\u5728\u8c03\u7528 numpy.load() \u65f6\u5c06 allow_pickle \u53c2\u6570\u8bbe\u7f6e\u4e3a true\uff1a<\/p>\n<pre>import numpy\n\n# \u60a8\u7684\u4ee3\u7801\n\nd = numpy.load('123.npz', allow_pickle=True)\nlimit = d.get('limit', None)<\/pre>\n<p><strong>allow_pickle \u53c2\u6570\uff1a<\/strong><\/p>\n<p>allow_pickle \u53c2\u6570\u7528\u4e8e\u6307\u5b9a\u662f\u5426\u5141\u8bb8\u52a0\u8f7d\u5305\u542b python \u5bf9\u8c61\u7684\u6570\u7ec4\u3002\u5f53 allow_pickle=true \u65f6\uff0cnumpy.load() \u5c06\u5141\u8bb8\u52a0\u8f7d\u8fd9\u4e9b\u6570\u7ec4\u3002<\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u5f53 allow_pickle=true \u65f6\uff0c\u5e94\u7279\u522b\u5c0f\u5fc3\uff0c\u56e0\u4e3a\u52a0\u8f7d\u672a\u77e5\u6765\u6e90\u7684\u6570\u636e\u53ef\u80fd\u4f1a\u5e26\u6765\u5b89\u5168\u98ce\u9669\u3002\u56e0\u6b64\uff0c\u5efa\u8bae\u4ec5\u5728\u9700\u8981\u52a0\u8f7d\u5305\u542b python \u5bf9\u8c61\u7684\u6570\u7ec4\u65f6\u4f7f\u7528 allow_pickle=true\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300a\u4f7f\u7528 numpy.load() \u52a0\u8f7d\u5305\u542b None \u503c\u7684\u6570\u7ec4\u65f6\u5982\u4f55\u907f\u514d\u62a5\u9519\uff1f\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 numpy.load() &#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-205223","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=205223"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205223\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=205223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=205223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=205223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}