...
Code Block |
---|
if isinstance(config['param_baseline'], str): param_baseline = list(map(str, config['param_baseline'].split(', '))) param_baseline = [None if i=='None' else i for i in param_baseline] param_baseline = [float(i) if isinstance(i, str) else i for i in param_baseline] config['param_baseline'] = tuple(param_baseline) |
The first step is to convert it into a list and then convert the elements of the list into the right type. For tuple parameters in which their elements are the same type, there is no need to compute the two list comprehensions:
Code Block |
---|
if isinstance(config['param_tuple_floats'], str):
config['param_tuple_floats'] = list(map(str, config['param_tuple_floats'].split(', ')))
config['param_tuple_floats'] = tuple(config['param_tuple_floats']) |
Info |
---|
This parameter is entered the same way as a |
...