Issue
It just is possible to create a new tag using the Document object. How do I create a new tag if I just have a tag?
def bold(tag):
b = tag.new_tag('b') # no new_tag method here
tag.wrap(b)
Solution
All elements have the parents
generator, just get the last one:
def bold(tag):
b = list(tag.parents)[-1].new_tag('b') # find root element
tag.wrap(b)
Answered By - neves
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.