|
@@ -50,21 +50,16 @@ class FrontParser(Parser):
|
|
|
assert len(self.result) == len(self.confs), 'result and confs do not match'
|
|
|
|
|
|
def birth(self):
|
|
|
- # addString = []
|
|
|
- # for i in range(len(self.result)):
|
|
|
- # txt = self.result[i]
|
|
|
- # if "出生" in txt or "生" in txt:
|
|
|
- # # txt = txt.replace("出生", "")
|
|
|
- # txt = txt.split('生')[-1]
|
|
|
- # addString.append(txt.strip())
|
|
|
- # self.res["Birth"] = RecItem("".join(addString), self.confs[i])
|
|
|
- # break
|
|
|
if len(self.res["IDNumber"].text) == 18:
|
|
|
# 342423 2001 0 2 1 5 6552
|
|
|
# 012345 6789 10 11 12 13 14
|
|
|
str_num = self.res["IDNumber"].text
|
|
|
- self.res["Birth"].text = str_num[6:10] + "年" + str_num[10:12] + "月" + str_num[12:14] + "日"
|
|
|
-
|
|
|
+ date = list(str_num[6:10] + "年" + str_num[10:12] + "月" + str_num[12:14] + "日")
|
|
|
+ if date[date.index("月") - 2] == "0":
|
|
|
+ del date[date.index("月") - 2]
|
|
|
+ if date[date.index("日") - 2] == "0":
|
|
|
+ del date[date.index("日") - 2]
|
|
|
+ self.res["Birth"].text = "".join(date)
|
|
|
|
|
|
|
|
|
def card_no(self):
|