#This script is used to load all of the lines into one big xml file. from retrieve_line import retrieve_line from bs4 import BeautifulSoup import xml.etree.cElementTree as ET import requests lines_url = "https://www.stationsweb.nl/lijnoverzicht.asp" lines_page = requests.get(lines_url) lines_soup = BeautifulSoup(lines_page.text,"html.parser") tables = lines_soup.findAll("table") lines_table = tables[2] rows = lines_table.findAll("tr") lines_element = ET.Element("Lines") n = 0 for row in rows: columns = row.findAll("td") column_with_link = columns[0] link = column_with_link.find("a").attrs["href"] number = link[19:] line_element = retrieve_line(number) lines_element.append(line_element.toXML()) tree = ET.ElementTree(lines_element) ET.indent(tree,'\t') tree.write("Lines.xml")