#!/usr/bin/env python
from datetime import datetime
fl = open('tianchi_mobile_recommend_train_user.csv')
ns = open('data_16_16_3.csv','w+')
#na = open('data_17_17_2.csv','w+')
nsf = []
naf = []
format = "%Y-%m-%d"
fl.readline()
i = 1
for key in fl.readlines():
pt = key.split(',')
dt = pt[5].split(' ')
# print dt[0]
ti = datetime.strptime(dt[0],format)
if ti>datetime(2014,12,15) and ti<datetime(2014,12,17):
if pt[2] == '3':
ns.write(pt[0]+','+pt[1]+'\n')
# elif pt[2] == '2':
# na.write(pt[0]+','+pt[1]+'\n')
if i == 1:
print key
i = (i+1)%1000
#ns.write(nsf)
#na.write(na)
fl.close()
ns.close()
from datetime import datetime
fl = open('tianchi_mobile_recommend_train_user.csv')
ns = open('data_16_16_3.csv','w+')
#na = open('data_17_17_2.csv','w+')
nsf = []
naf = []
format = "%Y-%m-%d"
fl.readline()
i = 1
for key in fl.readlines():
pt = key.split(',')
dt = pt[5].split(' ')
# print dt[0]
ti = datetime.strptime(dt[0],format)
if ti>datetime(2014,12,15) and ti<datetime(2014,12,17):
if pt[2] == '3':
ns.write(pt[0]+','+pt[1]+'\n')
# elif pt[2] == '2':
# na.write(pt[0]+','+pt[1]+'\n')
if i == 1:
print key
i = (i+1)%1000
#ns.write(nsf)
#na.write(na)
fl.close()
ns.close()