请教日常文本txt文件处理,提取(我编辑了一下,txt格式有变)
summerblue52 summerblue52 用python吧,没几行代码
- #-*- coding: UTF-8 -*-
- import uniout # 打印unicode
- import re
- f='test202002.txt'
- for line in open(f):
- matchObj = re.search (r'^\d+ {8,}', line)
- if matchObj:
- print line
复制代码summerblue52 我也写了个正则
- (----+\s((?:.*?\r?\n?)*)\(结果个数)+
复制代码summerblue52 改了下上上楼python3的写法
- import re
- f='AAAA.txt'
- for line in open(f):
- matchObj = re.search (r'^\d+ {8,}', line)
- if matchObj:
- print(line)
复制代码77880099