Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import xml.etree.ElementTree as ET
- def getText(chapter,path):
- tree = ET.parse(path)
- root = tree.getroot()
- for child in root:
- if(child.get('number')==str(chapter)):
- return child.text
- return ""
- def getTitle(chapter,path):
- tree = ET.parse(path)
- root = tree.getroot()
- for child in root:
- if(child.get('number')==str(chapter)):
- return child.get('title')
- return ""
- def getSubtitle(chapter,path):
- tree = ET.parse(path)
- root = tree.getroot()
- for child in root:
- if(child.get('number')==str(chapter)):
- return child.get('subtitle')
- return ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement