对于列表["foo", "bar", "baz"]和列表中的项目"bar",如何在Python中获取其索引(1)?
["foo", "bar", "baz"]
"bar"
python indexing list
假设我有以下列表:
foo = ['a', 'b', 'c', 'd', 'e']
从此列表中随机检索项目的最简单方法是什么?
python random list
list ×2
python ×2
indexing ×1
random ×1