PyMARC Introduction to Python and
Introduction to Python and PyMARC
Session II: Using PyMARC Lauren Magnuson California State University, San Marcos
Hosted by ALCTS: Association for Library Collections & Technical Services
Quick Recap
Last week, we:
Learned how to install Python and PyMARC Learned how to run scripts using a command line interface (PowerShell, Terminal) Went over the GitHub repository of sample scripts
Session II Overview
Getting fields from MARC files
Handling missing fields
Manipulating fields and string data Looping through records and fields Writing data from MARC records to CSV Writing data from CSV to MARC
Getting fields from MARC records
from pymarc import MARCReader
#print all OCLC numbers (035|a) with open('marc.mrc', 'rb') as fh:
reader = MARCReader(fh) for record in reader:
print(record['035']['a'])
oclc1.py
Note: What is rb? It means "read binary" -
What if fields are missing in one of the records?
If we manually remove all 035 fields from the record (see marc_missing035.mrc)
TypeError: 'NoneType' object has no attribute '__getitem__'
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- logix 5000 controllers ascii strings 1756 pm013g
- pymarc introduction to python and
- i have a csv file and need to assign a data type to
- pandas dataframe notes
- programming principles in python csci 503 490
- python regex cheatsheet activestate
- esci 386 scientific programming analysis and
- data storage in python github pages
- python data persistence tutorialspoint
Related searches
- introduction to finance and accounting
- introduction to leadership and management
- introduction to java programming and data structures
- introduction to language and linguistics
- introduction to leadership and governance
- introduction to python pdf
- introduction to python programming pdf
- introduction to philosophy and logic
- introduction to positive and negative numbers
- introduction to leadership concepts and practice
- introduction to food and beverage service
- introduction to probability and mathematical statistics pdf