eval_dtype

pyhelpers.ops.eval_dtype(str_val)[source]

Convert a string to its intrinsic data type.

Parameters:

str_val (str) – a string-type variable

Returns:

converted value

Return type:

any

Examples:

>>> from pyhelpers.ops import eval_dtype

>>> val_1 = '1'
>>> origin_val = eval_dtype(val_1)
>>> origin_val
1

>>> val_2 = '1.1.1'
>>> origin_val = eval_dtype(val_2)
>>> origin_val
'1.1.1'