#!/usr/bin/env python3 import xml.etree.ElementTree as ET tree = ET.parse("sites.xml") root = tree.getroot() with open('index.html', 'w') as file: # tag = 0 tag_text = 1 name = 2 link = 3 image_name = 4 powered_by = 5 description_en = 6 description_ar = 7 head = f""" THome!
""" file.write( head ) # find the first 'item' object for child in root: #print(child.tag, child.attrib, child[name].text, child[textt].text) middle = f""" """ file.write(middle) end = f"""
""" file.write(end) file.close()