best way to find out type
- by laspal
hi,
I have a dict
val_dict - {'val1': 'abcd', 'val': '1234', 'val3': '1234.00', 'val4': '1abcd 2gfff'}
All the values to my keys are string.
So my question is how to find out type for my values in the dict.
I mean if i say`int(val_dict['val1']) will give me error.
Basically what I am trying to do is find out if the string is actual string or int or float.`
if int( val_dict['val1'):
dosomething
else if float(val_dict['val1']):
dosomething
thanks