Python - can a dict have a value that is a list?

前端 未结 3 1830
甜味超标
甜味超标 2020-12-17 16:14

When using Python is it possible that a dict can have a value that is a list?

for example, a dictionary that would look like the following (see KeyName3\'s values):<

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 16:35

    It definitely can have a list and any object as value but the dictionary cannot have a list as key because the list is mutable data structure and keys cannot be mutable else of what use are they.

提交回复
热议问题