More efficient way to look up dictionary values whose keys start with same prefix,result = [d[key] for key in d if key.startswith(query)]