Python¿âÏê½âÖ®ÍøÂç(1)
¸Õ¸ÕдÍêPythonǶÈ벿·ÖµÄ¼òµ¥Àý×Ó£¨²î²»¶à¹»ÏÖÔÚÓõÄÀ²~£©£¬½Ó×Å¿´µãʵ¼ÊµÄ¶«Î÷£¬Èç¹ûûÓÐÕâЩӦÓõϰ£¬Ç°ÃæµÄǶÈëҲûÓÐʲôÒâÒ塣ǶÈëµÄÆäËû²¿·ÖÒÔºóÓöµ½ÔÙд£¬²»±ØÒ»ÏÂ×Ó°ÑÄÇЩº¯Êý¶¼Åª¶®£¬ÊǰÉ~
OK£¬À´¿´Python¿âÖÐÎÒÈÏΪ×îºÃÍæµÄÒ»²¿·Ö£¬Ò²¾ÍÊÇPython¶ÔÍøÒ³µÄ²Ù×÷¡£
ÕâÆª¼òµ¥ËµÏÂÈçºÎͨ¹ýÍøÖ·ÏÂÔØÍøÒ³£¬Ç°ÌᵱȻÊÇÒªÄÜÉÏÍø¡£
ÎÒÕâÀïÊǽ«ÍøÒ×µÄÍøÒ³ÏÂÏÂÀ´±£´æÔÚtest.htmlÎļþÖС£
ÏÂÔØÍøÒ³Ö»ÐèÒª2ÐдúÂ룺
#×¢ÒâÏÖÔÚpython3.1°æ±¾ÓëÒÔǰÓÐÁ˺ܴó±ä»¯£¬¹ýÈ¥´úÂëºÃ¶à²»ÄÜÓã¬ÐèÒªÉÔ΢ÐÞ¸ÄÏÂŶ
import urllib.request
urllib.request.urlretrieve('http://www.163.com','test.html') #ÄãÃÇÓÃË«ÒýºÅÊÔÏ£¬ÎÒÕâÔõôÓÐÎÊÌ⣿µ¥ÒýºÅºÍË«ÒýºÅÔÚÕâÀïÓÐÇø±ðô£¿
ºÇºÇ£¬²»ÊǾõµÃÌ«¼òµ¥Á˵㣬µ«ÎÒ»¹ÊDZȽÏϲ»¶ÏÂÃæ´úÂë¶àµãµÄʵÏÖ·½Ê½£¨ÎÒûÓÐÌí¼ÓÒì³££¬Èç¹ûÊÇÉÔ΢ÕýʽµãµÄ±àÂ룬ÇëÌíЩ´¦ÀíÒì³£µÄ´úÂë°É£©£º
import urllib
import urllib.request
url=urllib.request.urlopen("http://www.163.com")
file=open("test.html",'wb') #it's 'wb',not 'w'
while(1):
line=url.readline()
if len(line)==0:
break
file.write(line)
ºÇºÇ£¬ÏÖÔÚÊDz»ÊǸоõÏÂÔØÍøÒ³ÕæÃ»Òâ˼~
OK£¬ÏÂÆªËµÏÂÈçºÎ½âÎöÎÒÃÇÏÂÔØÏÂÀ´µÄÍøÒ³£¬ÕâÑùÏÂÏÂÀ´µÄÍøÒ³²ÅÓÐÓÃÂï~ ^_^
Ïà¹ØÎĵµ£º
Python Firewall Win32 (pyfw-win32)
pyfw-win32ÊÇÒ»¸ö¿ÉÓÃPython½Å±¾¿ª·¢Êý¾Ý°ü¹ýÂË(·À»ðǽ)µÄÄ£¿é¡£µ×²ãʹÓÃCÓïÑÔ±àдµÄNDISÖмä²ãÇý¶¯(NDIS IMD)Ìṩ֧³Ö£¬ÉϲãÌṩPython¿ª·¢½Ó¿Ú¡£¿ÉÓÃPython½Å±¾´¦ÀíËùÓÐÂß¼ÎÊÌ⣬¶ø²»±Ø¹ØÐĵײãʵÏÖ£¬´ïµ½¿ìËÙ¡¢Áé»î¿ª·¢µÄÄ¿µÄ¡£
Google ÏîÄ¿Íйܣº
http://code.google.com/p/py ......
½ñÌì¿´ÁËÐòÁÐÀàÐÍÏà¹ØµÄ±È½Ï²Ù×÷.
ÔÚpythonºËÐıà³Ì(2nd)Ò»ÊéÖÐ6.13.1Õ½ÚÖÐ, ¸ø³öÁËÁбí±È½ÏµÄÒ»¸ö×¼Ôò..
¸öÈ˸оõ»¹ÊDz»ºÜÍêÉÆ:
Èç¹ûɨÃèµ½Á½¸öÁбíÖе±Ç°±È½ÏÔªËØÊDz»¿É±È½ÏµÄ, ÄÇô·µ»ØÊ²Ã´??
ÎÒÓõÄÊÇpython2.6....
¶ÔÕâ¸öÎÊÌâ×öÁËһЩ²âÊÔ, ×Ô¼ºÄ¿Ç°¸Â¾øµ±±È½ÏÓöµ½ÉÏÊöÇé¿öʱ, ÊÇʹÓÃÁ½¸öÁбíµÄÄÚ´æµØÖ·ÖµÀ´±È½ ......
filename=raw_input('enter file name:')
f=open(filename,'rb')
f.seek(0,0)
index=0
for i in range(0,16):
print "%3s" % hex(i) ,
print
for i in range(0,16):
print "%-3s" % "#" ,
print
while True:
temp=f.read(1)
if len(temp) == 0:
break
else:
print "%3s" % temp.encode('hex'),
......
ZoundryDocument
Python skin is known for its color variations and for its elasticity; it is
the warmest leather of the season and ideal for the manufacture of many luxury
goods. Sometimes natural patterns can be hidden when they're done in black, but
the finish here has a bit of a shine to it ......
×òÌìÊÔÁËÏÂÓÃHTMLParserÀàÀ´½âÎöÍøÒ³£¬¿É·¢ÏÖ½á¹û²¢²»ÀíÏë¡£²»¹ÜÔõô˵£¬ÏÈдϹý³Ì£¬Ï£ÍûºóÀ´ÈËÄÜÔÚ´Ë»ù´¡ÉϽâ¾öÎÒËùÓöµ½µÄÎÊÌâ¡£
дÁË2Ì×½â¾ö·½°¸£¬µ±È»Õâ2Ì×Ö»ÄܶÔÌØ¶¨ÍøÕ¾ÓÐЧ¡£ÎÒÕâÀïÖ÷Ҫ˵Ã÷϶ÔBBCÖ÷Ò³www.bbc.co.ukºÍ¶ÔÍøÒ×www.163.comµÄ½âÎö¡£
¶ÔÓÚBBC£º
ÕâÌ×Òª¼òµ¥µÃ¶à£¬¿ÉÄÜÊǸÃÍøÒ³µÄ±àÂë±È½Ï±ê×¼°É
import ......