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!'
Ïà¹ØÎĵµ£º
Ò»¡¢pythonÊÇʲô£¿
Æäʵ£¬python¾ÍÊÇÒ»Ãűà³ÌÓïÑÔ£¬¾ÍÏñjavaÒ»Ñù¡£±¾À´ÊÇÔÚµçÄÔÉϵ쬵«ÊÇËæ×ÅÊÖ»úµÄÁ÷ÐУ¬python±»ÒÆÖ²µ½ÁËÊÖ»úÉÏ£¬Í¬Ê±Ò²±»ÃüÃûΪpyS60¡£
¶þ¡¢pyÈí¼þµÄ¹¹Ôì
ËùÓеÄpyÈí¼þ¶¼Òª°üÀ¨ÈçÏÂÎļþ£º.app--1.65k£».rsc--337b£».aif¡£ÕâÈý¸öÎļþÔÚËùÓÐpyÈí¼þÖж¼ÊÇÏàͬµÄ£¬Î¨Ò»µÄÇø±ð¾ÍÊÇÈí¼þµÄuid²»Í¬¡£ÕâЩÎļ ......
1. µÚÒ»Õ¡¡Python¿ìËÙÈëÃÅ
±¾ÕÂÊÇPythonµÄ¿ìËÙÈëÃÅ£¬ÔÚÕâÒ»Õ²¢²»Éæ¼°pythonµÄÌØÊâ¹æÔòºÍϸ½Ú£¬Ä¿±êÊÇͨ¹ýʾÀýʹÄã¿ìËÙÁ˽âPythonÓïÑÔµÄÌØµã¡£±¾Õ¼òÒª½éÉÜÁ˱äÁ¿,±í´ïʽ,¿ØÖÆÁ÷,º¯ÊýÒÔ¼°ÊäÈë/Êä³öµÄ»ù±¾¸ÅÄî,ÔÚÕâÒ»Õ²»Éæ¼°PythonÓïÑԵĸ߼¶ÌØÐÔ¡£¾¡¹ÜÈç´Ë£¬ÓоÑéµÄ³ÌÐòÔ±»¹ÊÇÄܹ»Í¨¹ýÔĶÁ±¾ÕµIJÄÁÏ´´½¨¸ß¼¶³ÌÐò¡£ÎÒÃÇ ......
python ÖеÄre Ä£¿é
ÕýÔò±í´ïʽ
¾Í¸öÈ˶øÑÔ£¬Ö÷ÒªÓÃËüÀ´×öһЩ¸´ÔÓ×Ö·û´®·ÖÎö£¬ÌáÈ¡ÏëÒªµÄÐÅÏ¢
ѧϰÔÔò£º¹»ÓþÍÐУ¬ÐèÒªµÄʱºòÔÚÉîÈë
ÏÖ×ܽáÈçÏ£º
ÕýÔò±í´ïʽÖÐÌØÊâµÄ·ûºÅ£º
“.” ±íÈÎÒâ×Ö·û
“^ ” ±ístringÆðʼ
“$” ±ístring ½áÊø
“*” “+” & ......
Python´úÂë
import string, os, sys
dir = '/var'
print '----------- no sub dir'
files = os.listdir(dir)
for f in files:
......
1.¿ÉÖ´ÐгÌÐò
os.system('pgrep %s > %s' % (process, output))
pidfile = open("output", 'r')
totalpid = len(pidfile.readlines())
pidfile.close()
if totalpid == 0 :
&nbs ......