Skip to content
C

Extract Titles from Sample HTML

Easypython

Given a set of products, build a small HTML page from them (matching the notes' own product-card structure) and use BeautifulSoup's find_all() to extract and print every title.

Approach: construct an HTML string with one <div class="product"> per product, each containing a nested <h2 class="title">, then parse it and pull out the title text of every match.

Input: First line: the number of products n. Next n lines: title,price.

Output: One line per product: its title.

Input (stdin)

Output

Run your code to see output here...