1、获取每行的字符 res = re.search(r".+", "\ntoday\nis\nsunday",re.S)匹配换行,找到每行的数据
print(res.group())结果是:
today
is
sunday
2、获取身份在对应数字的含义
res = re.search("(?P<province>[0-9]{2})(?P<city>[0-9]{2})(?P<county>[0-9]{2})(?P<year>[0-9]{4})(?P<month>[0-9]{2})(?P<day>[0-9]{2})(?P<other>[0-9]{4})","371235198805209870") print(res['province'])结果是:37