[英]Accessing indexed element of a list, where the list is a value of a python dictionary
i Have a dictionary where the values are list, i have something like this:我有一个字典,其中的值是列表,我有这样的东西:
dic = {"A":[6,4,7,10], "B":[8,10,90,100]}
how do i access the element 7 from the list where the key is "A"?如何从键为“A”的列表中访问元素 7?
只需添加一个额外的索引,如dic['A'][2]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.