取中间四位,然后使用replace进行替换
def phonelist1(self, phone):
# 取出中间四位
list = phone[3:7]
# 加密
newphone = phone.replace(list,'****')
return newphone
取中间四位,然后使用replace进行替换
def phonelist1(self, phone):
# 取出中间四位
list = phone[3:7]
# 加密
newphone = phone.replace(list,'****')
return newphone