Please help me with basics of dict.
请帮我解决dict的基础知识。
I have a dict which has value as a list below:
我有一个dict,其价值如下:
test = {2:['a',2,4,6], 3:[1,2,4,8]}
i need to get value with index[0] in k==2
我需要在k == 2中获得索引[0]的值
output must be 'a'
输出必须是'a'
1 个解决方案
#1
0
Really simple:
test[2][0]
If you are a beginner you should check out the python docs for information on dict access.
如果您是初学者,您应该查看python文档以获取有关dict访问的信息。
#1
0
Really simple:
test[2][0]
If you are a beginner you should check out the python docs for information on dict access.
如果您是初学者,您应该查看python文档以获取有关dict访问的信息。