如何从列表中检索单词的位置?

2024-04-16 23:34:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个列表,我需要检索单词的位置,到目前为止,我有,我想打印的单词位置是海

Sentence = [she , sells , sea , shells ,on , the, sea , shore]
print (sentence.find(sea))

知道我做错了什么吗?你知道吗


Tags: the列表onfind单词sentenceprintshe