{"author_url":"https://blog.hatena.ne.jp/nishiohirokazu/","published":"2011-11-18 17:28:24","categories":[],"image_url":null,"width":"100%","title":"Numpy\u306endarray\u306f\u7a7a\u3067\u306a\u304f\u3066\u3082\u507d\u306b\u306a\u308b","description":"Python\u306e\u30ea\u30b9\u30c8\u306e\u5834\u5408\u3001if\u306e\u6761\u4ef6\u5f0f\u306b\u5165\u308c\u3066bool\u306b\u5909\u63db\u3055\u308c\u305f\u5834\u5408\u306f\u65e5\u672c\u8a9e\u3067\u8a00\u3046\u3068\u300c\u7a7a\u304b\u3069\u3046\u304b\u300d\u306b\u306a\u308b\u3002 >>> if []: print \"not empty\" >>> if [0]: print \"not empty\" not empty >>> print bool([]), bool([0]) False True\u3067\u3082Numpy\u306endarray\u306f\u305d\u3046\u3067\u306f\u306a\u3044\u3002 >>> print bool(array([])), bool(array([0])) False False\u3053\u308c\u306f\u3001ndarray\u306f\u300c1\u8981\u7d20\u3067\u4e2d\u8eab\u304c0\u306e\u6642\u306b\u306f\u30bc\u30ed\u3067\u3042\u308b\u300d\u3068\u8a2d\u8a08\u3055\u308c\u3066\u3044\u308b\u305b\u3044\u3002 >>> array([0]\u2026","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnishiohirokazu.hatenadiary.org%2Fentry%2F20111118%2F1321604904\" title=\"Numpy\u306endarray\u306f\u7a7a\u3067\u306a\u304f\u3066\u3082\u507d\u306b\u306a\u308b - \u897f\u5c3e\u6cf0\u548c\u306e\u306f\u3066\u306a\u30c0\u30a4\u30a2\u30ea\u30fc\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","blog_title":"\u897f\u5c3e\u6cf0\u548c\u306e\u306f\u3066\u306a\u30c0\u30a4\u30a2\u30ea\u30fc","provider_name":"Hatena Blog","type":"rich","provider_url":"https://hatena.blog","height":"190","blog_url":"https://nishiohirokazu.hatenadiary.org/","author_name":"nishiohirokazu","version":"1.0","url":"https://nishiohirokazu.hatenadiary.org/entry/20111118/1321604904"}