Python conftree: valToBool method
This commit is contained in:
parent
3a5c1a0b6b
commit
0b6aa25dd4
@ -304,3 +304,14 @@ def stringsToString(vs):
|
||||
out.append(s)
|
||||
return " ".join(out)
|
||||
|
||||
def valToBool(s):
|
||||
if not s:
|
||||
return False
|
||||
try:
|
||||
val = int(s)
|
||||
return val != 0
|
||||
except:
|
||||
pass
|
||||
if type(s) == type(b''):
|
||||
s = s.decode("UTF-8")
|
||||
return s[0] in "tTyY"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user