Advertisement
interligator

asuspass.py

Mar 20th, 2013
1,776
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.12 KB | None | 0 0
  1. # this is NOT a generator for asuspass.txt!
  2. # It doesn't generate or helps to generate anything!
  3. # just tried to find out a common pattern for those
  4.  
  5. import datetime
  6.  
  7. def check_date(db):
  8.     x1='2002-01-02'
  9.     x2='2011-12-31'
  10.     d1 = datetime.datetime.strptime(x1, '%Y-%m-%d')
  11.     d2 = datetime.datetime.strptime(x2, '%Y-%m-%d')
  12.     d = d1
  13.     for s in db:
  14.         a, b = s.split(" ")
  15.         f = d.strftime('%Y-%m-%d')
  16.         if f==a:
  17.             d = datetime.datetime(d.year+1, d.month, d.day)
  18.             print a, b
  19.  
  20. def check_dupes(db):
  21.     h = {}
  22.     for s in db:
  23.         a, b = s.split(" ")
  24.         c = b[:2]
  25.         b = b[2:]
  26.         k = '%s (%s)' % (a, c)
  27.         if b in h.keys():
  28.             h[b] = '%s, %s' % (h[b], k)
  29.         else:
  30.             h[b] = k
  31.  
  32.     for p in h:
  33.         print p, '=>', h[p]
  34.  
  35. def check_dict(db):
  36.     x={}
  37.     for s in db:
  38.         a, b = s.split(" ")
  39.         for c in b:
  40.             x[c]=1
  41.  
  42.     print "".join(sorted(x.keys()))
  43.  
  44. if __name__=='__main__':
  45.     db = file("asuspass.txt").read().splitlines()
  46.     check_date(db)
  47.     check_dupes(db)
  48.     check_dict(db)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement