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