I can't understand following execution. I expected different results.
>>> f = {'ms':'ma'}
>>> isinstance(f['ms'], type(str))
False
>>> isinstance(f['ms'], type(dict))
False
>>> type(f['ms'])
<class 'str'>
I can't understand following execution. I expected different results.
>>> f = {'ms':'ma'}
>>> isinstance(f['ms'], type(str))
False
>>> isinstance(f['ms'], type(dict))
False
>>> type(f['ms'])
<class 'str'>
 
    
    type(str) and type(dict) each return type, so you are checking if your objects are instances of type, which they are not.
If you want to check if something is a string, use
isinstance(f['ms'], str)
not
isinstance(f['ms'], type(str))
And if you want to test if something is a dict, you can use
isinstance(f['ms'], dict)
not
isinstance(f['ms'], type(dict))
 
    
    I think you just want this:
>>> f = {'ms':'ma'}
>>> isinstance(f['ms'], str)
True
You don't need type(str)
