Python (Regular Expressions) I am looking at the following html and I need to extract the names in Python. I need the following code to extract the names(male and female) from a website. HTML
how you can determine if it's male or female?
I would suggest you paste that string into the Input are on the site: http://re.dabase.com/ and then play around with regex until you get it right. another good one is here: http://www.pythonregex.com/
**Input area
@ Tomas The first name is male and the second is female for all of the html. <tr align="right"><td>2</td><td>Christopher</td><td>Ashley</td> <tr align="right"><td>3</td><td>Matthew</td><td>Brittany</td> <tr align="right"><td>4</td><td>Joshua</td><td>Amanda</td> <tr align="right"><td>5</td><td>Daniel</td><td>Samantha</td>
ah i see..
type this into the regex box of the link I gave you and then click the Python button: <td>[^<]*</td><td>([^<]+)</td><td>([^<]+)</td>
Put this in the Input area: <tr align="right"><td>2</td><td>Christopher</td><td>Ashley</td>
sorry - I missed a .* at the start, the regex should be this: .*<td>[^<]*</td><td>([^<]+)</td><td>([^<]+)</td>
the web site I listed can come in very useful when dealing with regular expressions.
Join our real-time social learning platform and learn together with your friends!
Join our real-time social learning platform and learn together with your friends!