I am trying to insert a comment in html using beautiful soup, I want to insert it before head closure, I am trying something like this
soup.head.insert(-1,"<!-- #mycomment -->")
It's inserting before </head>
but the value gets entity encoded <!-- #mycomment -->
. Beautiful Soup documentation speaks about inserting a tag but how should I insert a comment as it is.