Created
April 29, 2014 14:46
-
-
Save psd/11402527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from bs4 import BeautifulSoup | |
from json import JSONEncoder | |
def xml2json(text): | |
xml = BeautifulSoup(text, 'xml') | |
#print xml.prettify() | |
title = { | |
'title_number': xml.TitleNumber.string | |
} | |
return JSONEncoder().encode(title); | |
if __name__ == "__main__": | |
print xml2json(open('../concept-register-data/BD251159.xml')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment