使用当前浏览器访问考试宝,无法享受最佳体验,推荐使用 Chrome 浏览器进行访问。
单选题 给定以下代码,d是什么类型的数据结构? D={'name':'John','age':30}
给定以下代码,d是什么类型的数据结构? D={'name':'John','age':30}
列表
集合
元祖
字典
相关试题
单选题 如何获取字典中所有的键(keys)?
dict.keys()
dict.values()
单选题 Python中while循环的基本结构是什么?
while condition:statements
while condition <= true:statements
while statements:condition
while:condition, statements
单选题 在字典操作中,哪个方法可以用来删除并返回字典中的最后一个键值对?
popitem()
pop()
remove()
delitem()
单选题 在Python中,如何正确创建一个空字典?
dic=[ ]
dic={ }
doc=( )
dic=set( )
单选题 以下哪个方法不是字典的内置方法?
get()
update()
append()
clear()
单选题 字典的get()方法的作用是什么?
删除字典中的一个元素
添加一个键值对到字典
返回字典中键对应的值,如果键不存在则返回None
单选题 如何向字典中添加一个新的键值对?
dict.add('height', 175)
dict['height'] = 17
dict.append({'height': 175})
dict.insert(0, 'height', 175)
单选题 如何检查一个键是否存在于字典中?
dict.has_key('key')
'key' in dict
dict.contains('key')