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

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') ÉèÖÃÒ»¸öÎı¾ÓòµÄÖµ¡£µÚÒ»¸ö²ÎÊýΪÎı¾ÓòµÄÃû³Æ,µÚ¶þ¸ö²ÎÊýΪҪÊäÈëµÄÖµ£¬
ie.buttonClick('btnA') ÓÃÀ´Ä£Äâµã»÷°´Å¥ ²ÎÊýÊǰ´Å¥µÄÃû×Ö
ie.findText(unicode("µÇ¼", "cp936")) ²éÕÒÎı¾ Èç:
if (True == ie.findText(unicode("·Ç·¨µÇ¼", "cp936"))):
print "·Ç·¨µÇ¼!"
else:
print "µÇ¼³É¹¦!"
ie.quit() -- ¹Ø±Õ´ò¿ªµÄie
ie.goBack() -- ºóÍË
ie.refresh() -- Ë¢ÐÂ
ie.buttonGetValue('wp-submit','value') µÃµ½Ò»¸öÎÞËØµÄÆäËüÖµ,µÚÒ»¸ö²ÎÊýΪÄãÖªµÀµÄÔªËØÊôÐÔÈç:id, name, value µÈ,µÚ¶þ¸ö²ÎÊýΪÄãÒªµÃµ½µÄÕâ¸öÔªËØµÄÆäËüÖµ,ÕâÑùÈç¹ûÄãÖªµÀname,¾Í¿ÉµÃµ½id,valueµÈ,Èç¹ûÖªµÀname¾Í¿ÉÖªµÀid,value.....
ie.buttonClick('down') Õâ¸ö·½·¨µÄ²ÎÊý¿ÉÒÔÊÇname,ID,VALUEµÈ,×¢:NAMEºÍVALUEΪÖÐÎÄʱ¼Ç×ÅתÂëÈç:unicode("¶ÏÏß", "cp936")
ie.elementsGetList(tag, [filter], ) ·µ»ØÒ»¸ö¹ýÂ˺óµÄÔªËØÁбí
·û¼¸¸öÀý×Ó:
Õâ¸öÊǽ«ÎÄÕÂÌá½»¸øGOOGLEÊղؼеĽű¾,Ó÷¨ postgoogle.py http://blog.alexa-pro.cn/index.php
import cPAMIE,re,string,time,sys
ie= cPAMIE.PAMIE()
args = sys.argv

ie.navigate(args[1])
Title=ie.locationName().strip()
Title=Title.replace('GGclub','').replace(' Blog Archive ','')

ie.navigate('https://www.google.com/accounts/Logout?continue=http://www.google.com/intl/zh-CN/&hl=zh-CN')
ie.navigate('https://www.google.com/accounts/ServiceLogin?hl=zh-

CN&continue=http://www.google.com/bookmarks/mark%3Fop%3Dadd%26bkmk%3Dhttp%253A%252F%252Fblog.alexa-pro.cn%252F%

26title%3DGGclub&nui=1&service=bookmarks')
ie.textBoxSet('Email','yingguang08@gmail.com')
ie.textBoxSet('Passwd','*******')
ie.buttonClick('signIn')

ie.textBoxSet('title',Title)
ie.textBoxSet('bkmk',args[1])
ie.textBoxSet('labels','python')
ie.textBoxSet('annotation','python linux')
ie.buttonClick('btnA')
½âÊÍ:
ÏÈÖ´Ð


Ïà¹ØÎĵµ£º

python joinµÄÓ÷¨

>>> a="abcd"
>>> ",".join(a)
'a,b,c,d'
>>> "|".join(['a','b','c'])
'a|b|c'
>>> ",".join(('a','b','c'))
'a,b,c'
>>> ",".join({'a':1,'b':2,'c':3})
'a,c,b' ......

python ÃüÁîÐвÎÊý


±¾Æª½«½éÉÜpythonÖÐsys, getoptÄ£¿é´¦ÀíÃüÁîÐвÎÊý
Èç¹ûÏë¶Ôpython½Å±¾´«²ÎÊý£¬pythonÖжÔÓ¦µÄargc, argv(cÓïÑÔµÄÃüÁîÐвÎÊý)ÊÇÊ²Ã´ÄØ£¿
ÐèҪģ¿é£ºsys
²ÎÊý¸öÊý£ºlen(sys.argv)
½Å±¾Ãû£º    sys.argv[0]
²ÎÊý1£º     sys.argv[1]
²ÎÊý2£º     sys.argv[2]
test.py
1
import ......

zzʹÓà Python ·ÖÀëÖÐÎÄÓëÓ¢ÎĵĻìºÏ×Ö´®

ʹÓà Python ·ÖÀëÖÐÎÄÓëÓ¢ÎĵĻìºÏ×Ö´®
LiYanrui

posted @ ´óÔ¼ 1 Äêǰ
in ³ÌÐòÉè¼Æ
with tags
python

, 614 ÔĶÁ


Õâ¸öÎÊÌâÊÇ×ö MkIV Ô¤´¦Àí³ÌÐò
ʱ¸ã¶¨µÄ£¬¾ÍÊǰÑÒ»¸ö»ìºÏÁËÖÐÓ¢ÎÄ»ìºÏ×Ö´®·ÖÀëΪӢÎÄÓëÖÐÎĵÄ×Ó×Ö´®£¬Æ©È磬½« ”ÎÒµÄ English ѧµÄ²»ºÃ
&ld ......

PythonÖ®HTMLParser

"""A parser for HTML and XHTML."""
# This file is based on sgmllib.py, but the API is slightly different.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity references and end tags a ......

ʹÓÃpdbµ÷ÊÔPython³ÌÐò

ʹÓÃpdbµ÷ÊÔPython³ÌÐò
 
±¾ÎÄÌÖÂÛÔÚûÓз½±ãµÄIDE¹¤¾ß¿ÉÓõÄÇé¿öÏ£¬Ê¹ÓÃpdbµ÷ÊÔpython³ÌÐò
 
Ô´ÂëÀý×Ó
ÀýÈ磬ÓÐÄ£Äâ˰ÊÕ¼ÆËãµÄ³ÌÐò£º
 
#!/usr/bin/python
def debug_demo(val):
                if val &l ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ