Yes, this is the best solution because they are implemented as hash tables giving approximately constant search time (if the hash function is good). Binary trees give a logarithmic search time, if- linear time. Hash tables are generally suitable if you need to represent a mapping from a not-so-large finite set to some other set.
BTW, Python - , Python .