Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python
- import os, glob
- from xml.dom import minidom
- path = "OEBPS/Text" # your mileage may vary
- list = []
- new_list = []
- def cssList():
- for infile in glob.glob(os.path.join(path, '*html')):
- html = minidom.parse(infile)
- for node in html.getElementsByTagName('p'):
- list.append(node.getAttribute('class'))
- list.append(node.getAttribute('style'))
- for node in html.getElementsByTagName('div'):
- list.append(node.getAttribute('class'))
- list.append(node.getAttribute('style'))
- for node in html.getElementsByTagName('span'):
- list.append(node.getAttribute('class'))
- list.append(node.getAttribute('style'))
- for node in html.getElementsByTagName('i'):
- list.append(node.getAttribute('class'))
- list.append(node.getAttribute('style'))
- for node in html.getElementsByTagName('em'):
- list.append(node.getAttribute('class'))
- list.append(node.getAttribute('style'))
- for node in html.getElementsByTagName('strong'):
- list.append(node.getAttribute('class'))
- list.append(node.getAttribute('style'))
- for node in html.getElementsByTagName('b'):
- list.append(node.getAttribute('class'))
- list.append(node.getAttribute('style'))
- # add tags as required...
- for i in list:
- if i not in new_list:
- if i is not None:
- if i:
- new_list.append(i)
- return new_list
- if __name__ == "__main__":
- for item in (cssList()):
- print item
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement