You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
548 B
Python
24 lines
548 B
Python
|
3 years ago
|
from bs4 import BeautifulSoup
|
||
|
|
|
||
|
|
def make_soup(file):
|
||
|
|
with open(file, 'r', encoding="utf-8") as opening:
|
||
|
|
xml = BeautifulSoup(opening, 'xml')
|
||
|
|
return xml
|
||
|
|
|
||
|
|
def get_places(file):
|
||
|
|
soup = make_soup(file)
|
||
|
|
for div in soup.find_all('div', {'xml:id': True}):
|
||
|
|
print(div['n'])
|
||
|
|
for place in div.find_all('placeName', {'type': 'production_place'}):
|
||
|
|
print(place.text)
|
||
|
|
|
||
|
|
|
||
|
|
def get_archives(file):
|
||
|
|
soup = make_soup(file)
|
||
|
|
for div in soup.find_all('orgName', {'type': 'main'}):
|
||
|
|
print(div.text)
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
get_archives("../bourbon-latex/charles-actes-latex.xml")
|