Skip to main content
← CoursesPython for Office WorkersModule 3 · Web ScrapingBeautifulSoup — extract a tablepredict9 / 50
💬 Discuss🧪 Playground+125 XP
Task
Given this HTML scraped into `table`: <table> <tr><th>Item</th><th>Price</th></tr> <tr><td>Pen</td><td>$3</td></tr> <tr><td>Pad</td><td>$12</td></tr> </table> What does for tr in table.find_all("tr")[1:]: cells = [td.get_text(strip=True) for td in tr.find_all("td")] print(cells) print? Type the two list literals on two lines.

Keep going

🔮 Predict the output

Read the code carefully

What will the program print? Write here:

📣 Help someone learn PythonShare this lesson with a friend — the first 15 are free, no signup.Tweet

💬 Discussion

Be the first to ask a question or share a tip.
Sign in to join the discussion. Reading is free.
Loading discussion…