欢迎来到牛牛题库网 牛牛题库官网
logo

单项选择题

下面有一段英文绕口令,统计其中“wish”出现的次数以及它出现的所有位置,在代码段中需要填入的是( )。
str1 = "I wish to wish the wish you wish to wish, but if you wish the wish the witch wishes, I won't wish the wish you wish to wish."
word = "wish"
count = str1.count(word)
order = ""
pos = -4
for i in range(count):
        此处应填入的代码是?      
     order += str(pos)+" "           
print("'wish'出现的次数:{}".format(count))
print("'wish'出现的位置包括:{}".format(order))
知识点:字符串的find方法
A、pos = str1.find(word, pos+len(word))
B、pos = str1.find(word, pos)
C、pos = str1.find(word, len(word))
D、pos = str1.find(word, pos-len(word))

点击查看答案&解析
微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题