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