根据一个字符查找器出现在字符串中的下标。 代码如下: def find(word,letter): index = 0 while index < len(word): if word[index] == letter: return index index = index + 1 return -1 测试结果: >>> find('name','m') 2 >>> find('name','o') -1