curriculum/challenges/english/blocks/daily-coding-challenges-python/68cae5b538ff798bbd4da004.md
Given a string of HTML code, remove the tags and return the plain text content.
For example, '<a href="#">Click here</a>' should return "Click here".
strip_tags('<a href="#">Click here</a>') should return "Click here".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(strip_tags('<a href="#">Click here</a>'), "Click here")`)
}})
strip_tags('<p class="center">Hello <b>World</b>!</p>') should return "Hello World!".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(strip_tags('<p class="center">Hello <b>World</b>!</p>'), "Hello World!")`)
}})
strip_tags('') should return an empty string ("").
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(strip_tags(''), "")`)
}})
strip_tags('<main id="main"><section class="section">section</section><section class="section">section</section></main>') should return sectionsection.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(strip_tags('<main id="main"><section class="section">section</section><section class="section">section</section></main>'), "sectionsection")`)
}})
def strip_tags(html):
return html
import re
def strip_tags(html):
return re.sub(r'<[^>]*>', '', html)