Python: pythonдµÄÒ»¸ö¼òµ¥ÍøÂç´Êµä
ÏÐÀ´ÎÞÊÂ, ÍæÍæpython...
ÊDzÉÓÃÓеÀ·Òë, È»ºóץȡÍøÒ³µÄ.
import re, urllib
url="http://dict.youdao.com/search?le=eng&q="
print ("input q to exit")
while 1:
word = raw_input(">>>")
if word=="q":
exit()
else:
word = word.replace(' ', '+')
url += word
url += "&tab=chn&keyfrom=dict.top"
s = urllib.urlopen(url).read()
comm1 = re.compile(';</td><td class="attributem1web">.*?</td>')
result=comm1.findall(s)
comm2 = re.compile(r'<td class="dttitle2"><font color="#013694"><b>.*?<\/b><\/font><\/td>')
related = comm2.findall(s)
#find the result
if result:
print 'meaning:'
for i in result:
temp = i.decode('utf8').encode('cp936')
temp = temp[33:]
temp = temp[:-5]
print temp
print '\n'
#fine the matters
if related:
print 'related:'
for i in related:
temp = i.decode('utf8').encode('cp936')
temp = temp[46:]
temp = temp[:-16]
print temp
print '\n'
else:
print 'no such word!'
Ïà¹ØÎĵµ£º
ÀµÓºƣ¨http://laiyonghao.com£©
½ñÌ죨2009Äê5ÔÂ31ÈÕ£© OurPNP.org ¸ãÁ˸ö¾Û»á»î¶¯£¬ÅªÁËÊ®¼¸¶þÊ®¸öÈËÔÚ¹ãÖݺ£Öé¹ã³¡µÄÌûá´ôÁËÎå¸öСʱ£¬´´ÏÂÁËÎÒÔÚ K ·¿´ôµÄ×ʱ¼ä¼Í¼¡£Ó¦ËûÃǵÄÑûÇ룬ÎÒ×öÁ˸öÌâΪ¡¶Óà python ¿ìËٴÍøÓηþÎñÆ÷¡·µÄСÑݽ²£¬ÒòΪÄDZߵĵçÊÓ¾¹È»²»ÄܽӵçÄÔ£¬ËùÒÔ½²µÄʱºòûÓÐÄܹ»²ÎÕÕ PPT À´½²£¬¹Û ......
Ò»¡¢pythonÊÇʲô£¿
Æäʵ£¬python¾ÍÊÇÒ»Ãűà³ÌÓïÑÔ£¬¾ÍÏñjavaÒ»Ñù¡£±¾À´ÊÇÔÚµçÄÔÉϵģ¬µ«ÊÇËæ×ÅÊÖ»úµÄÁ÷ÐУ¬python±»ÒÆÖ²µ½ÁËÊÖ»úÉÏ£¬Í¬Ê±Ò²±»ÃüÃûΪpyS60¡£
¶þ¡¢pyÈí¼þµÄ¹¹Ôì
ËùÓеÄpyÈí¼þ¶¼Òª°üÀ¨ÈçÏÂÎļþ£º.app--1.65k£».rsc--337b£».aif¡£ÕâÈý¸öÎļþÔÚËùÓÐpyÈí¼þÖж¼ÊÇÏàͬµÄ£¬Î¨Ò»µÄÇø±ð¾ÍÊÇÈí¼þµÄuid²»Í¬¡£ÕâЩÎļ ......
PythonµÄ´´Ê¼ÈËΪGuido van
Rossum¡£1989ÄêÊ¥µ®½ÚÆڼ䣬ÔÚ°¢Ä·Ë¹Ìص¤£¬GuidoΪÁË´ò·¢Ê¥µ®½ÚµÄÎÞȤ£¬¾öÐÄ¿ª·¢Ò»¸öеĽű¾½âÊͳÌÐò£¬×öΪ ABC
ÓïÑÔµÄÒ»Öּ̳С£Ö®ËùÒÔÑ¡ÖÐ Python£¨´óòþÉßµÄÒâ˼£©×÷Ϊ³ÌÐòµÄÃû×Ö£¬ÊÇÒòΪËûÊÇÒ»¸öMonty PythonµÄ·ÉÐÐÂíÏ·Íŵİ®ºÃÕß¡£
ABCÊÇÓÉGuido²Î¼ÓÉè¼ÆµÄÒ»ÖÖ½ÌѧÓïÑÔ¡£¾ÍGuido±¾ÈË¿´ ......
Python´úÂë
import string, os, sys
dir = '/var'
print '----------- no sub dir'
files = os.listdir(dir)
for f in files:
......
#
-*- encoding: gb2312 -*-
import
os, sys, string
import
MySQLdb
#
Á¬½ÓÊý¾Ý¿â
try
:
conn
=
MySQLdb.connect(host
=
'
localhost
'
,user
=
'
root
'
,passwd
=
'
xxxx
'
,db
=
'
test1
'
)
except
Exception, e:
print
e
sys.exit()
......