Skip to content

Instantly share code, notes, and snippets.

@vortec
Created January 2, 2013 11:41
Show Gist options
  • Select an option

  • Save vortec/4434014 to your computer and use it in GitHub Desktop.

Select an option

Save vortec/4434014 to your computer and use it in GitHub Desktop.
Python 2.7.3 (default, Apr 20 2012, 22:39:59)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from BeautifulSoup import BeautifulSoup, Tag, CData
>>> s=BeautifulSoup("")
>>> s=BeautifulSoup("<div></div>")
>>> n=s.find('div')
>>> n
<div></div>
>>> n.append(CData('<b>bleh</b>'))
>>> n
<div><![CDATA[&lt;b&gt;bleh&lt;/b&gt;]]></div>
>>>
-----------------------
Python 2.7.2 (default, Nov 22 2011, 17:08:06)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from BeautifulSoup import BeautifulSoup, Tag, CData
>>> s=BeautifulSoup("<div></div>")
>>> n=s.find('div')
>>> n.append(CData('<b>bleh</b>'))
>>> n
<div><![CDATA[<b>bleh</b>]]></div>
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment