Summary

In this chapter, we took a look at the content modification techniques in Beautiful Soup. The creation and addition of new tags and the modification of attribute values were discussed with the help of an example. The deletion and replacing of content was also explained. Finally, we dealt with some special functions, such as replace_with(), wrap(), and unwrap(), which are very helpful when it comes to dealing with changing the contents.

In the next chapter, we will discuss the encoding support in Beautiful Soup.

Get Getting Started with Beautiful Soup now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.