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

python½Å±¾Ä£Äâä¯ÀÀÆ÷

£¨Å¼¶û¿´µ½£¬ÅÂÍüÁË£©
·ÂÓû§´ò¿ªä¯ÀÀÆ÷È»ºóµã»÷µÈÐÐΪȻºó»ñÈ¡½á¹û£¬ÒÔÏÂÊÇÎÒʹÓùýµÄ·½·¨Ö»ÊÇÒÀÀµÓëie²»¹ýfirefoxµÈÓ¦¸ÃÒ²ÓÐÏàÓ¦µÄµ÷Ó÷½·¨£º
˼·¾ÍÊǵ÷ÓÃieµÄcom×é¼þÈ»ºó¾ÍÊǶÔdomµÄ²Ù×÷¸úÓÃjavascript²Ù×÷domÀàËÆ£¬Ê¾·¶´úÂëÈçÏÂ
#ÌìÑĵǽµØÖ·
tianyalogin = "http://www.tianya.cn/"
tianya_user = "xxxxx"
tianya_pw = "xxxxx"
ie = win32com.client.Dispatch("InternetExplorer.Application")
ie.Visible = 0
#¿ªÊ¼µÇ½
ie.Navigate(tianyalogin)
state = ie.ReadyState
print "´ò¿ªµÇÂ½Ò³Ãæ"
while 1:
state = ie.ReadyState
if state ==4:
break
sleep(1)
print "Ò³ÃæÔØÈëÍê±Ï£¬ÊäÈëÓû§ÃûÃÜÂë"
state = None
ie.Document.getElementById("text1").value=tianya_user
ie.Document.getElementById("password1").value=tianya_pw
ie.Document.getElementById("button1").click()
while 1:
state = ie.ReadyState
print state
if state ==4 and str(ie.LocationURL) == "http://
cache.tianya.cn/index.htm":
break
sleep(1)
print "µÇ½³É¹¦"



Ïà¹ØÎĵµ£º

Python Socket ±à³Ì

client:
import socket, sys
if __name__ == '__main__':
    #´¦Àí²ÎÊý
    argv = sys.argv
    if (len(argv)!=3) or (len(argv)==2 and argv[1]=='/?'):
        print '>>>Useage:', argv[0], '<address> < ......

Python×Ö·û´®±àÂë

ÔÚPythonÖÐÓÐÐ©ÌØÊâµÄµØ·½ÊÇ´æÔÚÁ½ÖÖ×Ö·û´®£¬·Ö±ðΪstrºÍunicode×Ö·û´®£¬ËûÃǶ¼¼Ì³Ð×Ôbasestring¡£
È磺s="hello world"£¬sΪstr£»us=u"hello world"£¬usΪunicode¡£
ʹÓÃhelp(str)ºÍhelp(unicode)¿ÉÒԲ鿴¸÷×Ô˵Ã÷£¬ËûÃǶ¼ÓÐdecode¡¢encode·½·¨£¬
decodeÓÃÓÚ½«str×Ö·û´®½âÂëΪunicode×Ö·û´®£¬
encodeÓÃÓÚ½«unicode×Ö·û ......

pythonѧϰ

     ÔÚpythonÖУ¬ÈκÎÊý¾ÝÀàÐͶ¼ÊÇ“¶ÔÏ󔣬°üÀ¨pythonÌṩµÄÄÚÖöÔÏó£¬Ò²°üÀ¨Óû§Í¨¹ýpythonÓïÑÔ»òÕßCÀ©Õ¹¿â´´½¨µÄ¶ÔÏó¡£
     pythonµÄ¶ÔÏóÊǶ¯Ì¬ÀàÐÍ£¬¶øÇÒÊÇÇ¿ÀàÐÍ£¬ÕâÒâζ×ÅÖ»ÓÐÀàÐÍÆ¥ÅäµÄʱºò²ÅÄܽøÐÐÏàÓ¦µÄ²Ù×÷¡£ÏÖÔÚ£¬ÎÒÃÇÀ´Ñ§Ï°pythonµÄÄÚÖöÔÏó£¬pythonµÄÄ ......

pythonÄ£¿éÖ®smtplib: ÓÃpython·¢ËÍSSL/TLS°²È«Óʼþ

pythonµÄsmtplibÌṩÁËÒ»Öֺܷ½±ãµÄ;¾¶·¢Ë͵ç×ÓÓʼþ¡£Ëü¶ÔsmtpЭÒé½øÐÐÁ˼òµ¥µÄ·â×°¡£
     smtpЭÒéµÄ»ù±¾ÃüÁî°üÀ¨£º
         HELO Ïò·þÎñÆ÷±êʶÓû§Éí·Ý
         MAIL ³õʼ»¯Óʼþ´«Êä mail from:
 &nb ......

pythonÁ½¸ödictÏà¼Ó


>>> a = {'1':'2'}
>>> b = {'3':'4'}
>>> a+b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'dict' and 'dict'
>>> a.update(b)
>>> a
{'1': '2', '3': '4'} ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ