Home / Challenges / Extract All Links from HTML

Extract All Links from HTML

Medium
Write a function extract_links(html) that takes a string of HTML and returns a list of all href attribute values found in <a> tags, using BeautifulSoup.

Input

A string containing HTML markup.

Output

A list of href strings.

Example

Input
'<a href="https://a.com">A</a><a href="https://b.com">B</a>'
Output
['https://a.com', 'https://b.com']
15 XP on solve Back to lesson

Your Solution

Output
Click "Run" to execute your code...

Log in to submit your solution and earn XP.