Last active
August 29, 2015 14:21
-
-
Save djpillen/b5cbff05be0c9db5d19f to your computer and use it in GitHub Desktop.
Print Extents from EADs
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
import lxml | |
from lxml import etree | |
import os | |
from os.path import join | |
# Enter the path to the folder containing your EADs | |
path = 'path/to/EADs' | |
# Check each file in the EAD folder | |
for filename in os.listdir(path): | |
tree = etree.parse(join(path, filename)) | |
extents = tree.xpath('//ead/archdesc/did//physdesc/extent') # Check each collection level extent | |
for e in extents: # Output the contents of each extent | |
extent = e.text | |
print 'The extent of ' + filename + ' is: ' + extent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment