Guest User

Untitled

a guest
Aug 17th, 2011
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.12 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. hdata = [
  4.     ['D', 'I', 'R', 'A', 'R', 'T', 'I', 'C', 'L', 'E'],
  5.     ['H', 'B', 'N', 'O', 'F', 'R', 'A', 'M', 'E', 'S'],
  6.     ['F', 'I', 'G', 'U', 'R', 'E', 'O', 'N', 'A', 'V'],
  7.     ['S', 'G', 'H', 'E', 'A', 'D', 'E', 'R', 'U', 'A'],
  8.     ['E', 'S', 'C', 'O', 'M', 'M', 'A', 'N', 'D', 'P'],
  9.     ['C', 'E', 'N', 'T', 'E', 'R', 'L', 'Y', 'I', 'P'],
  10.     ['T', 'W', 'Y', 'A', 'S', 'I', 'D', 'E', 'O', 'L'],
  11.     ['I', 'T', 'I', 'M', 'E', 'F', 'O', 'N', 'T', 'E'],
  12.     ['O', 'R', 'D', 'A', 'T', 'A', 'L', 'I', 'S', 'T'],
  13.     ['N', 'E', 'G', 'A', 'C', 'R', 'O', 'N', 'Y', 'M']
  14.     ]
  15.  
  16. # Make reverse list of lists
  17. vdata = list()
  18. for i in xrange(len(hdata[0])):
  19.     mini = list()
  20.     for j in xrange(len(hdata)):
  21.         mini.append(hdata[j][i])
  22.     vdata.append(mini)
  23.  
  24. newtags = ['article', 'aside', 'audio', 'bdo', 'canvas',
  25.            'command', 'datalist', 'details', 'embed',
  26.            'figcaption', 'figure', 'footer', 'header',
  27.            'hgroup', 'keygen', 'mark', 'meter', 'nav',
  28.            'output', 'progress', 'rp', 'rt', 'ruby',
  29.            'section', 'source', 'summary', 'time', 'video', 'wbr']
  30.  
  31. deprecatedtags = ['acronym', 'applet', 'basefont', 'big',
  32.                   'center', 'dir', 'font', 'frame',
  33.                   'frameset', 'isindex', 'noframes', 'strike', 'tt']
  34.  
  35. newfound = list()
  36. deprecatedfound = list()
  37.  
  38. ## Find
  39. for i in xrange(len(hdata)):
  40.     for j in newtags:
  41.         if j in reduce(lambda x, y: ''.join([x, y]), hdata[i]).lower():
  42.             newfound.append(j)
  43.     for k in deprecatedtags:
  44.         if k in reduce(lambda x, y: ''.join([x, y]), hdata[i]).lower():
  45.             deprecatedfound.append(k)
  46.  
  47. for i in xrange(len(vdata)):
  48.     for j in newtags:
  49.         if j in reduce(lambda x, y: ''.join([x, y]), vdata[i]).lower():
  50.             newfound.append(j)
  51.     for k in deprecatedtags:
  52.         if k in reduce(lambda x, y: ''.join([x, y]), vdata[i]).lower():
  53.             deprecatedfound.append(k)
  54.  
  55. ## Delete duo and sort
  56. newfound = sorted(set(newfound))
  57. deprecatedfound = sorted(set(deprecatedfound))
  58.  
  59. ## Print result
  60. print 'Find', len(newfound), 'from NEW tags', newfound
  61. print 'Find', len(deprecatedfound), 'from DEPRECATED tags', deprecatedfound
Advertisement
Add Comment
Please, Sign In to add comment