任何人都可以帮助我,我有一个列表2D,我想知道2D中myList的索引,但我只知道该索引的第一个值,例如我只知道'a2'
,我想要知道,包含'a2'
在第一值列表的索引,因为我想访问列表的例子,我想通过知道'a2'
访问['a2', 'b1']
:2维python列表索引
myList2= [['a1', 'b2', 'c1'], ['a2', 'b1'], ['b1', 'c2'], ['b2', 'c1'], ['c1'], ['c2']]
其他情况下....如果myList2是类对象的列表点。
另请参阅[这里](http://stackoverflow.com/questions/11963711/what-is-the-most-efficient-way-to-search-nested-lists-in-python),[这里](http://stackoverflow.com/questions/6889785/python-how-to-search-an-item-in-a-nested-list),和更多类似的问题。 – TigerhawkT3