{"author_url":"https://blog.hatena.ne.jp/owiewowe/","author_name":"owiewowe","version":"1.0","description":"\u30cd\u30bf\u304c\u7121\u3044\u306e\u3067\u4e00\u5fdc\u66f8\u304d\u7559\u3081\u3068\u3053\u3046\u304b\u3068\u3002 # a=[1, 0] \u3067\u3082\u540c\u3058\u7d50\u679c\u304c\u623b\u3063\u3066\u304d\u307e\u3059\u3002 a=[True, False] # True, False \u3067\u623b\u3063\u3066\u6b32\u3057\u3044\u306a\u3089 [not i for i in a] #[bool(abs(i-1)) for i in a], [bool(i-1) for i in a] >>[False, True] # 0,1 \u304c\u3044\u3044\u306a\u3089 [int(not i) for i in a] #[abs(i-1) for i in a] >>[0, 1] numpy \u306a\u3089 import numpy as np # a=[1, 0] \u3067\u3082 np.array \u3067\u3082\u540c\u3058\u7d50\u679c\u304c\u2026","height":"190","url":"https://owiewowe.hatenablog.com/entry/2022/06/19/100000","type":"rich","published":"2022-06-19 10:00:00","title":"python \u3067bool \u5024\u306e\u30ea\u30b9\u30c8 \u3092\u53cd\u8ee2\u3055\u305b\u308b","provider_url":"https://hatena.blog","categories":[],"width":"100%","blog_title":"19\u65e5\u306b\u66f4\u65b0\u3057\u3066\u305f","provider_name":"Hatena Blog","blog_url":"https://owiewowe.hatenablog.com/","image_url":null,"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fowiewowe.hatenablog.com%2Fentry%2F2022%2F06%2F19%2F100000\" title=\"python \u3067bool \u5024\u306e\u30ea\u30b9\u30c8 \u3092\u53cd\u8ee2\u3055\u305b\u308b - 19\u65e5\u306b\u66f4\u65b0\u3057\u3066\u305f\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>"}