This library provides classes for manipulating MARC21 formatted records. (Should work for USMARC, etc, too.)
The MARC21 file format standards can be found in the MARC Record Structure document at the Library of Congress MARC site.
This version fixes a bug that deals with the repitition of MARC21 fields and subfields. Please be aware that fields (ie. M['450']) can be either a single instance of a MARC21DataField or a list of instances. Similarly with the contents of subfields with in a field. When writing programs that deal with arbitrary MARC21 records, use type checking.
With data=None this initializes the MARC21Record to an empty state. If data is not None, then the data is used to construct the MARC21Record.fields(self)
Returns a list of fields that are present in this MARC record.
If data is None, then the MARC21DataField is constructed as a blank field. If data is supplied, then the field is constructed accordingly. This is currently used exclusively by the MARC21Record class.subfields(self)
Returns a list of subfields that are currently in this field.
Opens the specified file for read access.next(self)
Reads from the current position in the MARC21File and returns a MARC21Record instance based upon the data in the file. If the file is at EOF, None is returned.rewind(self,n=1)
Rewinds n records from the current position, or until BOF, whichever comes first.