content='<tr><td style="text-align:center;" height="30">12090043</td>'+\
'<td style="text-align:left;">CourseA</td>'+\
'<td style="text-align:center;">3</td>'+\
'<td style="text-align:left;">86</td><td>2013-Summer</td></tr>'+\
'<tr><td style="text-align:center;" height="30">10420844</td>'+\
'<td style="text-align:left;">CourseB</td>'+\
'<td style="text-align:center;">4</td>'+\
'<td style="text-align:left;">98</td><td>2013-Autumn</td></tr>'
pattern=re.compile('<tr>.*"30">(.*)</td>.*"text-align:left;">(.*)</td>.*"text-align:center;">(.*)</td>.*"text-align:left;">(.*)</td><td>(.*)</td></tr>')
items=re.findall(pattern,content)
print items
The output is:
[('10420844', 'courseB', '4', '98', '2013-Autumn')]
But the expected result is:
[('12090043', 'courseA', '3', '86', '2013-Summer'),('10420844', 'courseB', '4', '98', '2013-Autumn')]
Actually this code only returns the last match, if there are more than 2 matches. Can anyone tell me why is this happening? Sorry for the long code and thanks in advance!