def hasNumbers(chat):
res_list = [str(int(i)) if i.isdigit() else i for i in chat]
return “”.join(res_list)

print(hasNumbers(‘18971820999’))

def hasNumbers(chat):
res_list = [str(int(i)) if i.isdigit() else i for i in chat]
return "".join(res_list)

print(hasNumbers('18971820999'))

输出:18971820999