I have to copy a part of one document to another, but I don\'t want to modify the document I copy from.
If I use .extract() it removes the element from
.extract()
For Python:
You can copy the parent element like:
import copy p_copy = copy.copy(soup.p) print p_copy # I want pizza and more pizza!
I want pizza and more pizza!
Ref: https://www.crummy.com/software/BeautifulSoup/bs4/doc/ Section: Copying Beautiful Soup objects
Regards.