Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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£¬ÏÂƪ˵ÏÂÈçºÎ½âÎöÎÒÃÇÏÂÔØÏÂÀ´µÄÍøÒ³£¬ÕâÑùÏÂÏÂÀ´µÄÍøÒ³²ÅÓÐÓÃÂï~ ^_^


Ïà¹ØÎĵµ£º

£¨×ª£©UnicodeºÍPythonµÄÖÐÎÄ´¦Àí

      ——ÓÉÓÚ×î½üÔÚ×öÓйØÍøÒ³ËÑË÷µÄÏîÄ¿£¬Éæ¼°µ½Ò»Ð©±àÂë·½ÃæµÄ֪ʶ£¬Ð¡µÜÔÚÍøÉÏżȻµØ·¢ÏÖÁËÕâôһƪÎÄÕ£¬ºÜÒ׶®£¬²»»Þɬ£¬ÎªÁË·½±ã×Ô¼ºÒ²Í¬Ê±ÄÜ·½±ã´ó¼Ò£¬¾ÍתÁ˹ýÀ´£¬ÒÔ×÷²Î¿¼……
      ÎÄÕ³ö´¦£ºhttp://blog.csdn.net/tingsking18/arc ......

Python Socket Server

½ñÌì×öftpµÄ½çÃæ,×öµÄÏ൱ÓôÃÆ£¬ÅªµÃÐÄÇé¼°Æ䲻ˬ£¬ÔÚÍøÉÏËѵ½ËÀ¶¼²»ÖªµÀ¸ÃÔõô°ì£¬´òËãÃ÷ÌìÏÈ¿´¿´C£«£«
µÄÊÇÔõôŪµÄÔÙ˵¡£²»¹ý£¬ÏÖÔÚÎÒÏëдһϹØÓÚsocketµÄ±à³Ì¡£
ÏÈдһ¸öʱ¼ä·þÎñÆ÷°É£¬Ëû¼àÌý¶Ë¿Ú£¬²¢Çһ᷵»Ø ·þÎñÆ÷µÄʱ¼ä
server.py
#!/usr/bin/python
# Copyright (c) angelipin (angelipin@126.com)
import ......

¿ª·¢PythonÓÃʲô¹¤¾ßºÃ£¿

    ¹¤ÓûÉÆÆäʱØÏÈÀûÆäÆ÷£¡
    ¿ª·¢PythonÓÃʲô¹¤¾ßºÃÄØ£¿Æäʵ¸ÕѧPythonµÄ»°£¬Ê¹ÓÃIDLE¾Í¹»ÁË£¬ËäÈ»µ÷ÊÔ²»ÊÇÌر𷽱㣬µ«ÊǶÔÓÚ³õѧÒѾ­¹»ÁË£¬¿ÉÒÔʹÓÃPrint½øÐмòµ¥µÄµ÷ÊÔ£¬²»½¨ÒéʹÓüÇʱ¾½øÐпª·¢£¬²»ÖªµÀµÄÈÏΪÄãºÜÅ££¬ÖªµÀµÄ……ÕâÊÇ×Ô¼º¸ø×Ô¼ºÕÒ×ïÊÜ£¬ÓÃEditplusÃ²Ë ......

PythonǶÈëC++Ïê½â(3)

¼Ìǰƪ¡¶Import Module¡·£¨http://blog.csdn.net/xiadasong007/archive/2009/09/02/4512797.aspx£©£¬¼ÌÐø·ÖÎöǶÈ벿·Ö»ù´¡ÖªÊ¶¡£Õâ´Î²»¶à˵£¬ÓÐʲôÎÊÌâ¼ÇµÃ¶à²éÓ¢ÎÄ×ÊÁÏ£¬¹úÄÚµÄÕâ·½Ãæ֪ʶÉÙ
»¹ÊÇÀ´¿´´úÂ룬дÍêÎÒ¾Í˯¾õÁË~
 
#include "python/python.h"
#include <iostream>
using namespace std;
int ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ