Create a gist now

Instantly share code, notes, and snippets.

Print Extents from EADs
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