有很多功能,但我要保持简单:
这是我的密码:
[['Musique', 'Initiation au tango argentin suivi de la milonga', 182, 231], ['Musique', 'The Singing Pianos', 216, 216], ['Musique', 'Rythmes et détente : Duo Pichenotte', 216, 216]]
我只想将每个子列表的索引[1]作为字符串返回。它是法语的,但索引[1]是每个子列表的标题。每个子列表都是一个事件,我只需要返回名称。实际上,我的代码中有很多事件,但我想要一个简单的代码,我会尽我所能
因此,如果我们看我给你的代码示例,我必须返回:
Initiation au tango argentin suivi de la milonga
The Singing Pianos
Rythmes et détente : Duo Pichenotte
如果有一种方法可以把它们放在不同的行上,比如我的return示例,那也太好了
我尝试过:
我很难在子列表中使用索引。只返回每个列表的标题str是很重要的。我试着用了一段时间
while i < len(events):
print(events[i][:1][0:1]) # That would search every index i need, right ?
but it didnt work. there is more code involved but you get the picture and i dont want to add 8 functions to this scenario.
那么试试这个:
否则:
或者(numpy):
所有输出:
相关问题 更多 >
编程相关推荐