>>> s='''21899 6% S 15 173928K 38024K fg app_108 com.tencent.qq
21899 34% S 14 191436K 50888K fg app_108 com.tencent.qq
21899 49% S 14 183928K 41584K fg app_108 com.tencent.qq
21899 28% S 15 176984K 40240K fg app_108 com.tencent.qq
21899 6% S 15 177004K 40448K fg app_108 com.tencent.qq
21899 6% S 14 176048K 40564K fg app_108 com.tencent.qq
21899 10% S 14 176196K 40472K fg app_108 com.tencent.qq
21899 9% S 14 176232K 40712K fg app_108 com.tencent.qq
21899 12% S 14 176288K 40820K fg app_108 com.tencent.qq
21899 10% S 14 176288K 40820K fg app_108 com.tencent.qq
21899 12% S 16 179376K 40904K fg app_108 com.tencent.qq'''
>>> open('a.txt','w').write(s)
>>> f=open('a.txt')
>>> f.read()
'21899 6% S 15 173928K 38024K fg app_108 com.tencent.qq\n21899 34% S 14 191436K 50888K fg app_108 com.tencent.qq\n21899 49% S 14 183928K 41584K fg app_108 com.tencent.qq\n21899 28% S 15 176984K 40240K fg app_108 com.tencent.qq\n21899 6% S 15 177004K 40448K fg app_108 com.tencent.qq\n21899 6% S 14 176048K 40564K fg app_108 com.tencent.qq\n21899 10% S 14 176196K 40472K fg app_108 com.tencent.qq\n21899 9% S 14 176232K 40712K fg app_108 com.tencent.qq\n21899 12% S 14 176288K 40820K fg app_108 com.tencent.qq\n21899 10% S 14 176288K 40820K fg app_108 com.tencent.qq\n21899 12% S 16 179376K 40904K fg app_108 com.tencent.qq'
>>> pprint.pprint(map(lambda x:re.findall('\d+? +?(\d+%) +?S +?\d+? +?(\d+K) +?(\d+K)',x),s.split('\n')))
[[('6%', '173928K', '38024K')],
[('34%', '191436K', '50888K')],
[('49%', '183928K', '41584K')],
[('28%', '176984K', '40240K')],
[('6%', '177004K', '40448K')],
[('6%', '176048K', '40564K')],
[('10%', '176196K', '40472K')],
[('9%', '176232K', '40712K')],
[('12%', '176288K', '40820K')],
[('10%', '176288K', '40820K')],
[('12%', '179376K', '40904K')]]
>>> pprint.pprint(map(lambda x:re.findall('\d+? +?(\d+%) +?S +?\d+? +?(\d+K) +?(\d+K)',x),open('a.txt').read().split('\n')))
[[('6%', '173928K', '38024K')],
[('34%', '191436K', '50888K')],
[('49%', '183928K', '41584K')],
[('28%', '176984K', '40240K')],
[('6%', '177004K', '40448K')],
[('6%', '176048K', '40564K')],
[('10%', '176196K', '40472K')],
[('9%', '176232K', '40712K')],
[('12%', '176288K', '40820K')],
[('10%', '176288K', '40820K')],
[('12%', '179376K', '40904K')]]
>>>