Skip to content
Advertisement

Beautiful Soup: extract 2 different tags and append them together in text only output

I have been playing around with beautiful soup trying to learn it. So far ive learned some stuff but im struggle to put my use case together. how do i print, both movieslist and moviescore text only appended together? appreciate the help and info. really enjoying python and some of its applications like web scraping.

JavaScript

Advertisement

Answer

The key here is to “zip” the two lists you have. But before this happens you need to get the text value from each element and strip it.

Here’s a slight modification of your code:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement