Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # this is NOT a generator for asuspass.txt!
- # It doesn't generate or helps to generate anything!
- # just tried to find out a common pattern for those
- import datetime
- def check_date(db):
- x1='2002-01-02'
- x2='2011-12-31'
- d1 = datetime.datetime.strptime(x1, '%Y-%m-%d')
- d2 = datetime.datetime.strptime(x2, '%Y-%m-%d')
- d = d1
- for s in db:
- a, b = s.split(" ")
- f = d.strftime('%Y-%m-%d')
- if f==a:
- d = datetime.datetime(d.year+1, d.month, d.day)
- print a, b
- def check_dupes(db):
- h = {}
- for s in db:
- a, b = s.split(" ")
- c = b[:2]
- b = b[2:]
- k = '%s (%s)' % (a, c)
- if b in h.keys():
- h[b] = '%s, %s' % (h[b], k)
- else:
- h[b] = k
- for p in h:
- print p, '=>', h[p]
- def check_dict(db):
- x={}
- for s in db:
- a, b = s.split(" ")
- for c in b:
- x[c]=1
- print "".join(sorted(x.keys()))
- if __name__=='__main__':
- db = file("asuspass.txt").read().splitlines()
- check_date(db)
- check_dupes(db)
- check_dict(db)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement