My regex is something like below
text = 'id 5 result pass
id 4 result fail
id 3 result fail
id 2 result fail
id 1 result pass'
for i in re.finditer('id (.+?) result (.+)', text):
id = i.group(1)
result = i.group(2)
print 'id'
print 'result'
The output is OK. But how do I reverse it to get the results in the other order where id will start from 1 with the pass or fail result