Hey everyone,
I'm trying to replace all instances of the leader with the same uniform text. This code works when I print the records to the console, but not when I open the mrc file in marcedit. Any help is much appreciated! Thank you!
with open(input('Enter file: '), 'rb') as marcfile:
reader = MARCReader(marcfile, utf8_handling='ignore', file_encoding='latin-1')
writer = MARCWriter(open(input('Enter outputfile: '),'wb')) #, force_utf8=True)
for record in reader:
try:
leader = Leader(' nz 22 n 4500')
record.leader = leader
# print(record.leader)
except UnicodeEncodeError:
continue
print(record)
writer.write(record)
writer.close()