11 lines
264 B
Python
11 lines
264 B
Python
def xml2bool(xml_str):
|
|
if xml_str is None:
|
|
return(None)
|
|
xml_str = xml_str.lower()[0]
|
|
if xml_str in ('t', '1'):
|
|
return(True)
|
|
elif xml_str in ('f', '0'):
|
|
return(False)
|
|
else:
|
|
raise ValueError('Not a boolean value')
|