Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list = []
- file = open('C:\to.txt', 'r')
- lines = file.readlines()
- file.close()
- for line in lines:
- subList = re.findall(r'href="([^"]+)"', line)
- for element in subList:
- list.append(element.lower())
- list.sort()
- print str(len(list)) + " Elements"
- # sort out WMG, JBM, TT, Tropers
- for i in range(len(list) - 1, -1, -1):
- if list[i].startswith("http://tvtropes.org/pmwiki/pmwiki.php/tropers/") or list[i].startswith("http://tvtropes.org/pmwiki/pmwiki.php/tropertales/") or list[i].startswith("http://tvtropes.org/pmwiki/pmwiki.php/wmg/") or list[i].startswith("http://tvtropes.org/pmwiki/pmwiki.php/justbugsme/"):
- list[i:i+1] = []
- for i in range(len(list) - 1, -1, -1):
- if list[i] == list[i-1]:
- list[i-1:i] = []
- print str(len(list)) + " individual Elements"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement