Getting koscom web page data using python
#!/usr/bin/python
import datetime
import time
import urllib
import re
pattern=re.compile(r'</td>.*-->', re.DOTALL)
while True:
now=datetime.datetime.now()
print str(now),
data=urllib.urlopen('http://stock.koscom.co.kr').read()
dlist=data.split('\n')
print re.sub(pattern, "", "".join(dlist[552:555]).replace('\t',''))
if now.hour >= 15: break
time.sleep(600)
'Programming' 카테고리의 다른 글
The Interactive Emacs-Lisp Mode (0) | 2012.08.11 |
---|---|
(emacs lisp) random (0) | 2012.08.11 |
sleep command in python (0) | 2012.08.10 |
(Python) Data Compression (0) | 2012.08.10 |
3 ways to define a JavaScript class (0) | 2012.08.05 |