°ÝʦÌù£ºÈçºÎʹÓÃpython×¥È¡ÍøÒ³Êý¾Ý
ÈçºÎʹÓÃpython,½«ÏÂÃæµÄÍøÒ³
http://quotes.money.163.com/corp/1034/code=600221.html
ÄÇÕÅ×ʲú¸ºÕ®±íץȡ³öÀ´£¬·¢µ½Ò»¸öÎı¾ÎļþÖУ¿
ÇëÁôÏÂqq,ÎÒ°ÝÄãΪʦ
Python code:
import re
import urllib2
notePattern = '<table width="125" border="0" align="left" cellpadding="5" cellspacing="0" class="dataTb04">(?P<code>[\s\S]*?)</table>*?'
web = urllib2.urlopen("http://quotes.money.163.com/corp/1034/code=600221.html")
content = web.read()
p = re.compile(notePattern)
iter = p.finditer(content)
for matcher in iter:
code = matcher.group('code')
newpattern = '<td>(?P<data>[\s\S]*?)</td>'
s = re.compile(newpattern)
i = s.finditer(code)
for m in i:
d = m.group('data')
if d == ' ' or d ==' ' or d == '  ':
print ''
elif d.startswith('<font'):
f = '<font color=red>(?P<info>[\s\S]*?)</font>'
pf = re.compile(f)
t = pf.finditer(d)
for mm in t:
print mm.group('info')
else:
print d
ɳÀÏʦ£¬³ÌÐòºÃÏñûÓÐÈ«²¿Ð´Í꣬¿É·ñ¼òÒª½éÉÜÒ»ÏÂÄãµÄ˼¿¼²½Ö裬²¢½«ÍêÕûµÄ³ÌÐòÌù³öÀ´£¿
Õâ¸ö±í»¹ËãºÃ£¬Õû¸ö±í½á¹¹±È½ÏÇå³þ£¬
ÓÃbeautiful
Ïà¹ØÎÊ´ð£º
×î½üÓÃpythonдһ¸ö³ÌÐò,×ÜÊÇÒì³£Í˳ö£¬µ«ÊÇȴû·¨ÓÃtry..exceptÀ´²¶×½
ÓÉÓÚû·¨·¢Í¼Æ¬£¬ËùÒÔ°ÑÏà¹ØµÄÐÅÏ¢´òÓ¡³öÀ´
Òì³£µÄÐÅÏ¢´óÖÂÈçÏ£º
python.exeÓöµ½ÎÊÌâÐèÒª¹Ø±Õ¡£ÎÒÃǶԴËÒýÆðµÄ²»±ã±íʾ±§Ç¸ ......
ʹÓÃÔ´Îļþ
#!/usr/bin/python
# Filename : helloworld.py
print 'Hello World'
ÎÒÔõôҲ¿´²»¶®£¡Ö»ÊÇ×îºóÒ»ÐÐÎÒÖªµÀ~~Ç°ÃæÁ½ÐÐÊÇʲôÒâË¼ÄØ£¿
½Ì³ÌÉÏ˵Èç¹ûÄãʹÓÃIDLE£¬ÇëʹÓò˵ ......
ËÍÆ¼öÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл
¡¶python¼òÃ÷½Ì³Ì¡·£¬¡¶pythonºËÐıà³Ì¡·
×÷Ϊϵͳ¹ÜÀí·½Ãæ£¬¡¶Python UNIXºÍLinuxϵͳ¹ÜÀíÖ¸ÄÏ¡·ÊDZ¾·Ç³£²»´íµÄÊé¡£
http://club.book.csdn.net/pic3/255142.jpg
ÒýÓÃ
×÷Î ......
ÎÒÿ´ÎÉÏ´«µÄÎļþ¶Áµ½µÄÊý¾Ý¶¼²»ÕýÈ·¡£2M µÄͼƬ¶ÁµÃ10¶àK ¡£¡£ÄÄλ´óÏÀ¿ÉÒÔ°ï°ïÎÒ°¡¡£
#!D:\ProgrammerTools\python26\python.exe
#encoding=utf-8
import cgitb
import os
cgitb.enable()
import cgi,urllib ......