<分区> 分区>
我想标题是不言自明的,不过,我会让自己更清楚。
我必须找到字符串中每个字符出现的索引。例如,
word = "banana"
def indexes(x, word):
#some code
return (list of indexes of x character in the word)
输出:
indexes('a', word)
>> [1, 3, 5]
我如何得到这个结果?
<分区> 分区>
我想标题是不言自明的,不过,我会让自己更清楚。
我必须找到字符串中每个字符出现的索引。例如,
word = "banana"
def indexes(x, word):
#some code
return (list of indexes of x character in the word)
输出:
indexes('a', word)
>> [1, 3, 5]
我如何得到这个结果?