从身份证号字符串中提取出生年月,小功能,在研办值班的时候用到的
前提提要
所有的身份证号都放在一个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()