def parse(data, key):
fp = BytesIO(data)
build_dictionary(fp, key)
records = Record.parse(fp)
out = StringIO()
print_records(records, fp=out)
out.seek(0)
if pygments is not None:
print(pygments.highlight(out.read(),
pygments.lexers.get_lexer_by_name('XML'),
pygments.formatters.get_formatter_by_name('terminal')))
else:
print(out.read())
评论列表
文章目录