Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sat Sep 2 03:32:13 2012 [pid 12461] CONNECT: Client "66.249.68.236"
- Sat Sep 2 03:32:13 2012 [pid 12460] [ftp] OK LOGIN: Client "66.249.68.236", anon password "gxxglxxxxt@google.com"
- Sat Sep 2 03:32:14 2012 [pid 12462] [ftp] OK DOWNLOAD: Client "66.249.68.236", "/pub/10.5524/100001_101000/100022/readme.txt", 451
- def OnlyRecent(line):
- print time.strptime(line.split("[")[0].strip(),"%a %b %d %H:%M:%S %Y")
- print time.time()
- if time.strptime(line.split("[")[0].strip(),"%a %b %d %H:%M:%S %Y") < time.time():
- return True
- return False
- (2012, 9, 2, 3, 32, 13, 5, 246, -1)
- 1347332968.08
- (2012, 9, 2, 3, 32, 13, 5, 246, -1)
- 1347332968.08
- (2012, 9, 2, 3, 32, 14, 5, 246, -1)
- 1347332968.08
- >>> import time
- >>> time.mktime((2012, 9, 2, 3, 32, 13, 5, 246, -1))
- 1346527933.0
- from datetime import datetime
- def OnlyRecent(line):
- return datetime.strptime(line.split("[")[0].strip(),"%a %b %d %H:%M:%S %Y") < datetime.now()
- seven_days = datetime.timedelta(days=7)
- def OnlyRecent(line):
- dt = datetime.datetime.strptime(line.split('[')[0].strip(), "%a %b %d %H:%M:%S %Y")
- return dt > datetime.datetime.now() - seven_days
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement