Skip to content

Instantly share code, notes, and snippets.

@zed

zed/test_bs4.py Secret

Created March 8, 2012 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zed/6deb8175ed03647981c3 to your computer and use it in GitHub Desktop.
Save zed/6deb8175ed03647981c3 to your computer and use it in GitHub Desktop.
from bs4 import BeautifulSoup
s = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Data Junction generated file.
Macro type "1000" is reserved. -->
<djmacros>
<macro name="Test" type="5000" value="TestValue">
<description>test</description>
</macro>
<macro name="AnotherTest" type="0" value="TestValue2"/>
<macro name="TestLocation" type="1000" value="C:\RandomLocation">
<description> </description>
</macro>
<djmacros>
"""
soup = BeautifulSoup(s, 'xml')
print(repr(soup.prettify()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment