diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2012-04-26 23:29:32 -0400 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2012-04-26 23:29:32 -0400 |
commit | f71ba86ec04e2ce0ff5a0e64f4f20becadcc6ddc (patch) | |
tree | 6d0aec2cc1659615ae903851789ea59f8eddf138 /bs4/element.py | |
parent | d1261fb0a2df9929658dfdc9fe5880974e287d21 (diff) |
Added a new method, wrap().
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bs4/element.py b/bs4/element.py index eb7e8aa..3ef6ef1 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -160,6 +160,11 @@ class PageElement(object): replace_with_children = unwrap replaceWithChildren = unwrap # BS3 + def wrap(self, wrap_inside): + me = self.replace_with(wrap_inside) + wrap_inside.append(me) + return wrap_inside + def extract(self): """Destructively rips this element out of the tree.""" if self.parent is not None: |