Advertisement
joshfokis

regex and threading help

Sep 2nd, 2014
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. import re, threading
  2.  
  3. name = open('list.txt', 'r')
  4. fout = open('names.txt', 'a')
  5.  
  6. def Parse():
  7.     for lines in name:
  8.         m = re.search('^Bob', lines)
  9.         if m:
  10.             a = m.group()
  11.             print a
  12.             fout.write(a+'\n')
  13.  
  14. numOfThreads = 12
  15. for i in range(numOfThreads):      
  16.     t = threading.Thread(target=Parse, args=())
  17.     t.start()
  18.     print str(threading.activeCount())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement