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

python Ä£¿éµÄ__name__ __main__

ÿ¸öÄ£¿é¶¼ÓÐÒ»¸öÃû³Æ£¬ÔÚÄ£¿éÖпÉÒÔͨ¹ýÓï¾äÀ´ÕÒ³öÄ£¿éµÄÃû³Æ¡£ÕâÔÚÒ»¸ö³¡ºÏÌرðÓÐÓÃ
——¾ÍÈçÇ°ÃæËùÌáµ½µÄ£¬µ±Ò»¸öÄ£¿é±»µÚÒ»´ÎÊäÈëµÄʱºò£¬Õâ¸öÄ£¿éµÄÖ÷¿é½«±»ÔËÐС£
ÿ¸öPythonÄ£¿é¶¼ÓÐËüµÄ__name__£¬Èç¹ûËüÊÇ'__main__'£¬Õâ˵Ã÷Õâ¸öÄ£¿é±»Óû§µ¥¶ÀÔËÐУ¬
ÎÒÃÇ¿ÉÒÔ½øÐÐÏàÓ¦µÄÇ¡µ±²Ù×÷¡£
#!/usr/bin/python
# Filename: using_name.py
if __name__ == '__main__':
     print 'This program is being run by itself'
else:
     print 'I am being imported from another module'
Êä³ö
$ python using_name.py
This program is being run by itself
$ python
>>> import using_name
I am being imported from another module


Ïà¹ØÎĵµ£º

ÔÚpythonÖд¦ÀíXML×ܽá

±¾ÎÄ×ܽáÁËÔÚPythonÖÐÖ÷ÒªµÄ¼¸ÖÖ´¦ÀíXMLµÄ·½·¨£º
Element Tree
SAX
Dom
ʹÓõÚÈý·½Àà¿âÈçAmara 2.x£¬ libxml2dom µÈ
Element Tree
Element TreeÊÇPython 2.5ÒýÈëµÄʹÓüòµ¥£¬¿ì½ÝµÄ´¦Àí·½·¨£¬ Ò²ÊÇPython±ê×¼Àà¿âÍƼöµÄ´¦ÀíXMLµÄ·½·¨¡£
ËüʹÓÃÊ÷ÐνڵãµÄÐÎʽÀ´¶ÁдXML¡£Element TreeÊÇÇáÁ¿¼¶µÄDOM£¬ ËùÒÔÊ ......

ZZ python´¦ÀíÖÐÎÄ


ÒÔÏÂΪÎÒÔÚ´¦ÀíÍøÒ³±àÂëÎÊÌâ¿´µÄÎÄÕ£¬ÏÖÔÚдÅÀ³æ×Ô¼º´¦ÀíÍøÒ³±àÂëÎÊÌâȷʵ±È½ÏÂé·³£¬ÍøҳҲûÓй涨
Ò»¶¨ÒªÔÚMETAÍ·ÐÅÏ¢Àï´ø±àÂëÐÅÏ¢£¬¶øºÜ¶àÈËдµÄ̽²â±àÂë¾ÍÊÇ»ñÈ¡META£¬ÕâÊDz»¿ÉÈ¡µÄ£¬¶øÓеÄÈËÔòÊÇ·ÖÎöHTTP·µ»ØµÄÊý¾Ý°üÀï±ßµÄ
charset£¬È磨a.headers.getparam('charset')£©£¬¶øHTTP°üûÓй涨һ¶¨Òª´øcharset£¬ËùÒ ......

PamieÄ£¿éÏê½â python²Ù×÷ieä¯ÀÀÆ÷

from http://blog.alexa-pro.cn/?p=315
´ËÎĵµÊ¹ÓÃƽ̨Ϊ cPAMIE Build 2.0,ºÍ֮ǰµÄ°æ±¾ÓÐÃ÷ÏԵIJî±ð,¾ßÌå¿ÉÖ±½Ó¿´cPAMIE.py Ô´Âë
ÏÂÃæÊÇһЩ³£Óõķ½·¨
ie.navigate('http://blog.alexa.cn') ÓÃÀ´·ÃÎÊÒ»¸öÁ´½Ó¡£
ie.linkClick('linkname') ´ò¿ªÕâ¸öÒ³ÃæÖеÄÒ»¸öÁ¬½Ó ²ÎÊý: name»ò id
ie.textBoxSet('labels','python ......

Python´úÂë¼ÓÃÜ Ô´Âë±£»¤ pycÎļþ'×Ö½ÚÂë'

from   http://blog.alexa-pro.cn/?p=349
ÄÚÈݸÅÒª:Python´úÂë¼ÓÃÜ,Ô´Âë±£»¤,´úÂë±£»¤,pycÎļþ
------------------------------------------------
¹ØÓÚpython´úÂë±£»¤ÔÚÍøÉϺÃÏñһֱûÓкܺõĽéÉÜ,¿ÉÄܺÍPYTHONµÄÉè¼Æ³õÖÔ"¿ªÔ´"ÓйØ,µ«Ô½À´Ô½¶àµÄÐÖµÜдµÄ¼ÓÈëPYTHONÕóÓª,¿ª·¢¹¤¾ßÓÃ;¸÷Òì,ÔÚÉÌÒµÓ¦ÓÃÖдúÂë± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ