io_mod.py
def convert_val(val_str, val):
    """ Given a string, convert into the correct data type """
    if val is bool:
        if 'true' in val_str.lower(): val_str = 'true' 
        else: val_str = '' # otherwise set to false
    val_type = val
    try:
        return val_type(val_str)
    except ValueError:
        # Can it be a float ?
        return val_type(float(val_str))
 Given a string, convert into the correct data type 
Given a string, convert into the correct data type
Given a string convert into the correct data type
def convert_val(val_str, val):
    if val is bool:
        if 'true' in val_str.lower(): val_str = 'true' 
        else: val_str = '' 
    val_type = val
    try:
        return val_type(val_str)
    except ValueError:
        return val_type(float(val_str))
def convert_val ( val_str , val ) : if val is bool : if 'true' in val_str . lower ( ) : val_str = 'true' else : val_str = '' val_type = val try : return val_type ( val_str ) except ValueError : return val_type ( float ( val_str ) )
Given a string, convert into the correct data type
Given a string convert into the correct data type
""" Given a string, convert into the correct data type """ # otherwise set to false # Can it be a float ?
val_str
val