Guest User

Untitled

a guest
Dec 18th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import SomeClass
  2. import re
  3.  
  4. def process ( data ):
  5. print 'file size: ' + str(len(data))
  6.  
  7. file_data1 = open('data_file').readlines()
  8.  
  9. matches = []
  10. for str1 in file_data1 :
  11. file_data2 = open('data_file').readlines()
  12. process(file_data2)
  13.  
  14. for str2 in file_data2 :
  15. category = '1'
  16. m = re.search('^(\d\d)', str2)
  17. if m and m.group(0) :
  18. category = SomeClass.get_category_from_db(m.group(0))
  19.  
  20. m = re.search('\d{4}-\d{2}-\d{2} \w+ \w+ [A-Z]{2}\s[\w!.,]+', str2)
  21. if not m :
  22. continue
  23.  
  24. template = SomeClass.get_template_from_db(str1)
  25.  
  26. m = re.search('\d{4}-\d{2}-\d{2} ' + template + ' ' + category + ' [A-Z]{2}\s[\w!.,]+', str2)
  27. if m :
  28. matches.append( str2 )
  29.  
  30. if len(matches) > 0 :
  31. print 'match'
Add Comment
Please, Sign In to add comment