Advertisement
Guest User

Trope Overdosed

a guest
Dec 20th, 2010
1,026
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. list = []
  2. file = open('C:\to.txt',  'r')
  3. lines = file.readlines()
  4. file.close()
  5.  
  6. for line in lines:
  7.     subList = re.findall(r'href="([^"]+)"',  line)
  8.     for element in subList:
  9.         list.append(element.lower())
  10. list.sort()
  11.  
  12. print str(len(list)) + " Elements"
  13.  
  14. # sort out WMG,  JBM,  TT,  Tropers
  15. for i in range(len(list) - 1,  -1,  -1):
  16.     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/"):
  17.         list[i:i+1] = []
  18.  
  19. for i in range(len(list) - 1,  -1,  -1):
  20.     if list[i] == list[i-1]:
  21.         list[i-1:i] = []
  22. print str(len(list)) + " individual Elements"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement