def make_string(w):
s = ""
for n in w:
s = s + n
return s #缺此语句,s的值将始终为空
def add_to_index(index, keyword, strin):
index.append([keyword,strin])
return index
def make_big_index(size):
index = []
letters = ['a','a','a','a','a','a','a','a','a','a']
while len(index) < size: #当索引规模小于要求的大小时
word = make_string(letters)
add_to_index(index, word, "fake")
for i in range(len(letters)-1,0,-1): #range(len(letters)-1,0,-1)实现初始值为letters长度-1, 步长为-1,最小值为0的序列,帮助实现从letters数组的最后一个元素往前检验
if letters[i] < 'z':
letters[i] = chr(ord(letters[i]) +1)
break
else:
letters[i] = 'a'
return index
print make_big_index(100) #测试语句
s = ""
for n in w:
s = s + n
return s #缺此语句,s的值将始终为空
def add_to_index(index, keyword, strin):
#index = [] 这个语句不能出现,否则造成死循环
index.append([keyword,strin])
return index
def make_big_index(size):
index = []
letters = ['a','a','a','a','a','a','a','a','a','a']
while len(index) < size: #当索引规模小于要求的大小时
word = make_string(letters)
add_to_index(index, word, "fake")
for i in range(len(letters)-1,0,-1): #range(len(letters)-1,0,-1)实现初始值为letters长度-1, 步长为-1,最小值为0的序列,帮助实现从letters数组的最后一个元素往前检验
if letters[i] < 'z':
letters[i] = chr(ord(letters[i]) +1)
break
else:
letters[i] = 'a'
return index
print make_big_index(100) #测试语句