# 12573 - Python2020 Quiz7 Problem3 ###### tags: `Quiz` [TOC] ## Description Write a **function** named dehtml to remove tags from an HTML text and print out the text. Background: HTML, for Hypertext Markup Language, is the way web pages are formatted. It contains tags in the form of of angle bracketed tags. For example, |tag |description|example| |----|-----------|-------| |\<h1>heading 1\</h1>|1st-level heading|<h1>heading 1<h1/>| |\<a href="link"\>click me\</a\>|clickable anchor|<a href="link">click me</a>| |\<p\>paragraph 1\</p\>\<p\>paragraph 2\</p\>|paragraph|<p>paragraph 1</p> <p>paragraph 2</p>| The purpose of dehtml is to take out these angle-bracketed tags (i.e., formatting) and leave just the original text. **Note: You should replace each tag with a blank space.** #### Input One line. The HTML text. ##### Sample Input ``` <html>foo<a>bar</a>end</html> ``` #### Output The text that replaced each tag with a blank space. ##### Sample Output ``` foo bar end ``` ## Solution ```python import re def dehtml(text): return re.sub(r'<.*?>', ' ', text) html_text = input() print(dehtml(html_text)) ```