Extract strings in python
- by shadyabhi
Basically, I want to extract the strings "AAA", "BBB", "CCC", "DDD" from a text file..
...... (other text goes here).....
<TD align="left" class=texttd><font class='textfont'>AAA</font></TD>
..... (useless text here).....
<TD align="left" class=texttd><font class='textfont'>BBB</font></TD>
....(more text).....
<TD align="left" class=texttd><font class='textfont'>CCC</font></TD>
<TD align="left" class=texttd><font class='textfont'>DDD</font></TD>
......(more text).....
I want something like if I do:-
data = foo("file.txt")
i get:-
data = ['AAA','BBB','CCC','DDD']
What is the best possible way? My file is not big..