Beautiful Soup 简明教程
Beautiful Soup - Copying Objects
要创建任何标记或 NavigableString 的副本,请使用 Python 标准库中 copy 模块中的 copy() 函数。
Example
from bs4 import BeautifulSoup
import copy
markup = "<p>Learn <b>Python, Java</b>, <i>advanced Python and advanced Java</i>! from Tutorialspoint</p>"
soup = BeautifulSoup(markup, "html.parser")
i1 = soup.find('i')
icopy = copy.copy(i1)
print (icopy)