python's dic really fragrant

  • This picture shows the same code, but the speed change from list to hashmap

Suppose hashmap is dictionary
L and List,
then item in L lookup speed is O(n)
item in hashmap lookup speed is O(1)
and in hashmap.keys() in hashmap.values() alone will be faster! ! !

Guess you like

Origin blog.csdn.net/weixin_39666736/article/details/104289242