字典後保持正確的順序時,大約有1,2或3個單元只如何保持字典爲了荏苒
>>> a = ["dorian", "strawberry", "apple"]
>>> b = ["sweet", "delicious", "tasty"]
>>> c = dict(zip(a, b))
>>> c
{'dorian': 'sweet', 'strawberry': 'delicious', 'apple': 'tasty'}
但是,當有超過3元,訂單被打破
>>> a = ["dorian", "strawberry", "apple", "coconut"]
>>> b = ["sweet", "delicious", "tasty", "yum"]
>>> c = dict(zip(a, b))
>>> c
{'strawberry': 'delicious', 'coconut': 'yum', 'dorian': 'sweet', 'apple': 'tasty'}
任何人都可以請解釋爲什麼發生這種情況?謝謝
字典不保存順序 – Hoopdady