def boolean ( flag ) : s = flag . lower ( ) if s in ( '1' , 'yes' , 'true' ) : return True elif s in ( '0' , 'no' , 'false' ) : return False raise ValueError ( 'Unknown flag %r' % s )
how to replace boolean by 1 and 0 in python with if
Convert string in boolean
def boolean(flag):
    """
    Convert string in boolean
    """
    s = flag.lower()
    if s in ('1', 'yes', 'true'):
        return True
    elif s in ('0', 'no', 'false'):
        return False
    raise ValueError('Unknown flag %r' % s)