0

I have the following HTML text :

Country/<i>List it here</i><br><font color="#ff00ff">Dubai</font><br><br>

How do I extract 'Dubai' out of the above HTML? I have few hundreds such lines, kind of urgent, so not researching BeautifulSoup or XML parser implementation.

Thanks much!

1 Answer 1

2

Since you just want something quick and dirty, you could use:

re.match(r'.*>([^<>]*)</font>.*', s).group(1)

This just grabs all of the non angle-brackety things before a closing font tag. Again, not suitable for "real" parsing.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.