从身份证号字符串中提取出生年月,小功能,在研办值班的时候用到的

前提提要

            所有的身份证号都放在一个txt文件中了

'''从身份证号字符串中提取出生年月'''
result =[]
with open("test.txt", "r") as y:
    for line in y:
        line = line.strip('\n')
        result.append(line[6:-4])
    y.close()

with open("testresult.txt", "w") as x:
    for obj in result:
        x.write(obj)
        x.write('\n')
    x.close()
posted on 2021-06-09 22:28  雾恋过往  阅读(193)  评论(0编辑  收藏  举报

Live2D