Advertisement
Guest User

Untitled

a guest
Dec 29th, 2011
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import threading
  2. from threading import Thread
  3. import urllib2
  4.  
  5. link = ['http://finance.yahoo.com/q?s=BAC', 'http://finance.yahoo.com/q?s=GE']
  6. side = []
  7. line_num = []
  8. text = ['Powered by BATS Exchange">', 'Powered by BATS Exchange">']
  9. x = 0
  10. search_phrase = []
  11.  
  12.  
  13. def func1():
  14.     side[x] = urllib2.urlopen(link[x])
  15.     line_num[x] = 0
  16.     search_phrase[x] = text[x]
  17.     for line in side[x].readlines():
  18.         line_num[x] += 1
  19.         if line.find(search_phrase[x]) >= 0:
  20.             print line_num[x]
  21.  
  22.  
  23. for i in range(2):
  24.     Thread(target = func1).start()
  25.     x = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement