Every line of 'string to boolean python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
225 def _check_boolean(string): 226 """Attempt to convert a string to a boolean variable if matches.""" 227 if string in ['True', 'true']: 228 return True 229 elif string in ['False', 'false']: 230 return False 231 else: 232 return string
7 def bool_(string): 8 if string == 'True': 9 return True 10 elif string == 'False': 11 return False 12 else: 13 raise Exception()
21 def string_to_bool(string): 22 return bool(strtobool(str(string)))
305 def _parse_bool(string): 306 if string == 'true': 307 return True 308 else: 309 return False
138 def StringToBool(s): 139 if s is True or s is False: 140 return s 141 s = str(s).strip().lower() 142 return not s in ['false','f','n','0','']
22 def str2bool(string): 23 return string.lower() in ['yes', 'true', 't', 1]
181 def to_bool(s): 182 if s.lower() in ("yes", "1", "true", "t", "y"): 183 return True 184 return False
345 def boolean(s): 346 """Test whether a string is a Tk boolean, without error checking.""" 347 if s.lower() in ('', '0', 'no', 'off', 'false'): return 0 348 else: return 1