#-*-coding:utf-8-*-

import time
import re
import csv
#writer = csv.writer(file('your.csv', 'wb'),delimiter = ',', quotechar = '|', quoting = csv.QUOTE_MINIMAL)


file = open("d:\\brand.csv", "wb+")  
file.write('\xEF\xBB\xBF');  
writer = csv.writer(file) 
 
#for item in data:
    
_tezheng = {'2014030301004', '2014030302018', '2014030202003', '2014030301034', '2014030103026', '2014030104007', '2014030103019', '2014030401013', '2014030402013', '2014030305025', '2014030203003', '2014030202024', '2014030103027', '2014030202008', '2014030103004', '2014030305020', '2014030106016', '2014030101008', '2014030102004', '2014030102026', '2014030101032', '2014030303002', '2014030203022', '2014030106032', '2014030401009', '2014030304026', '2014030106029', '2014030101028', '2014030103024', '2014030102021', '2014030305014'}
#_tezheng = {'2014050101011', '2014020908013', '2014070910018', '2014030402003', '2014050101026', '2014040103008', '2014080101018', '2014050102034', '2014170101017', '2014020904010', '2014080201021', '2014060102032', '2014040205009', '2014120201007', '2014020906018', '2014180202010', '2014100101029', '2014010913013', '2014040102003', '2014190101018', '2014110903001', '2014190101025', '2014010908015', '2014200101015', '2014170201030', '2014220402030', '2014060103014', '2014220601039'} 
file_object = open("borrowhis.txt","r")  
_All_Line = file_object.readlines()  
file_object.close

_Count_Line =0


_Len_Line = len(_All_Line)
    
_Ex_Str = ''

print('Read Over --')

while _Count_Line<_Len_Line:
        _Str = _All_Line[_Count_Line]            
        for _tz_Str in _tezheng:
            if _tz_Str in _Str: #可以加and条件，这个贵一点，5毛一次 
				arbs = _Str.split(',')
				Book_id = arbs[9]
#				_Ex_Str+=_tz_Str+'	'+Book_id+'\r\n'
				_Ex_Str+=_Str+'\r\n'
        _Count_Line+=1
 
_f1 = open('temp.txt',"w")
_f1.write(_Ex_Str)
_f1.close() 

print 'Find Over--'  
print 'Find Over--'   

				
	

