Pythonでstr型をboolean型にする方法 2023年8月5日 / 1 min read View more blogs with the tag python Table of Contents #はじめに #方法 はじめに Pythonでstr型をboolean型にする方法です。 方法 distutils は python3.12 でなくなるらしいので、簡単な関数で。 def str2bool(s): return s.lower() in ["true", "t", "yes", "1"]