【问题标题】:How to Access all the element from <class 'list'>如何访问 <class 'list'> 中的所有元素
【发布时间】:2021-06-01 01:11:06
【问题描述】:
print(type(hum))
print(hum)

输出:

<class 'list'>
[BodyPart:0-(0.48, 0.19) score=0.78 BodyPart:1-(0.52, 0.37) score=0.64 BodyPart:2-(0.42, 0.38) score=0.65 BodyPart:3-(0.39, 0.58) score=0.43 BodyPart:4-(0.40, 0.65) score=0.30 BodyPart:5-(0.62, 0.36) score=0.53 BodyPart:6-(0.76, 0.58) score=0.46 BodyPart:7-(0.73, 0.71) score=0.20 BodyPart:8-(0.46, 0.86) score=0.14 BodyPart:11-(0.57, 0.85) score=0.09 BodyPart:14-(0.45, 0.16) score=0.81 BodyPart:15-(0.50, 0.15) score=0.75 BodyPart:16-(0.43, 0.18) score=0.48 BodyPart:17-(0.55, 0.16) score=0.81]

如何从列表中单独访问所有这些值?我想把相关信息放在多维数组或DataFrame中。

那么您能帮我从&lt;class 'list'&gt; 类型的“嗡嗡声”中获取值吗?

【问题讨论】:

标签: python arrays list class


【解决方案1】:

要在 python 中访问列表的每个元素,您可以循环访问每个元素:

for i in hum:
    print(i)

这将逐个打印列表中的每个元素

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-09
    • 1970-01-01
    • 2022-01-13
    • 2016-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多