Professional Documents
Culture Documents
Dict Vs Json
Dict Vs Json
Dict Vs Json
//in python dictionary we have any value as our key but key must be immutable . we
can have variable key types also in python dict like :
--------------------1(js)
//JavaScript object key names must adhere to some //restrictions to be valid. Key
names must either be //strings or valid identifier or variable names
//in javascript if key constains a space/symbol it must be writtin in quotes
//---------------------2(pyhton)
//in python we cant declare any mutable element as key like list map etc .
//tuple can be used
Keys in Python dictionaries must be hashable (e.g. a string, a number, a float),
while JavaScript does not have such a requirement.