import re f = open('F:\\a.txt','r') f2 = open('F:\\aa.txt','w') a = f.readlines() for i in a: b = re.search(r'^.*[0-9]\s+(.+)',i) print b.group(1) f2.write(b.group(1)) f.close() f2.close() 为什么会出错,AttributeError: 'NoneType' object has no attribute 'group' 求解