题目链接:
代码
def seven_ate9(str_):
if len(str_) < 3:
return str_
i = 1
s = list(str_)
while i < len(s) - 1:
if s[i] == '9' and s[i - 1] == '7' and s[i + 1] == '7':
del s[i]
continue
i += 1
return ''.join(s)
''.join()插入函数
del List[index] 删除函数