Python list, dict features and differences

dict features:

(1) The speed of searching and inserting is fast, and will not slow down as the key increases.

(2) It takes up a lot of memory

list features:

(1) The time of searching and inserting will increase with the increase of elements.

(2) Small footprint and less wasted memory.

Summary: Dictionaries use space in exchange for time, and the keys of dict must be immutable objects.

Dictionaries and lists are mutable sequences.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325336187&siteId=291194637