Last active
January 20, 2017 21:13
-
-
Save cmharlow/fe49d4a85a437df42795b97d955d6af0 to your computer and use it in GitHub Desktop.
for javed.
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 | |
import pymarc | |
import sys | |
input = sys.argv[1] | |
output = input + '.xml' | |
reader = pymarc.MARCReader(open(input, 'rb'), to_unicode=True) | |
with open(output, 'w') as writer: | |
writer.write("<collection xmlns='http://www.loc.gov/MARC21/slim'>") | |
for record in reader: | |
record.leader = record.leader[:9] + 'a' + record.leader[10:] | |
writer.write(pymarc.record_to_xml(record).decode('utf-8') + "\n") | |
writer.write("</collection>") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment