Appending multiple strings to a tag's content in Beautiful Soup
To append multiple strings to a tag's content in Beautiful Soup, use the
Tag.extend(~) method. This method is analogous to a standard Python List's
extend(~) method - it takes in an array of strings to append to the tag's content.
Consider the following HTML document:
my_html = "<p>Alex</p>"soup = BeautifulSoup(my_html)
To append two strings to the content of our
This method is only available for Beautiful Soup 4.7.0 and upwards.