import re import time def main(): # print('[{}] Hello world!'.format(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))) str = '15555555555' n = len(str) new_str = str[0:int(n/3)] +re.sub(r'.', '*', str[int(n/3):int(n*2/3)]) + str[int(n*2/3):] print(new_str) # 程序入口 if __name__ == '__main__': main()