易截截图软件、单文件、免安装、纯绿色、仅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笔记(5)

模块
 
一.简介
模块基本上就是一个包含了所有你定义的函数和变量的文件。为了在其他程序中重用模块,模块的文件名必须以.py为扩展名。
 
例如:
 
#!/usr/bin/python
# Filename: using_sys.py
import sys
print 'The command line arguments are:'
for i in sys.argv:
print i
print '\n ......

Python笔记(9)

Python中的文件操作以及输入输出
我们可以分别使用raw_input和print语句来完成这些功能。对于输出,你也可以使用多种多样的str(字符串)类。例如,你能够使用rjust方法来得到一个按一定宽度右对齐的字符串。利用help(str)获得更多详情。
 
 
另一个常用的输入/输出类型是处理文件。创建、读和写文件的能力是 ......

python 字节码指令列表

/***********************************************************
KVS:文件:opcode.h
swith字节码指令的文件:ceval.c
************************************************************/
/* KVS:字节码指令列表Instruction opcodes for compiled code */
#define STOP_CODE 0
#define POP_TOP  1
#def ......

很好的c++和Python混合编程文章

http://www.cppblog.com/jacky2019/archive/2007/05/17/24269.html
c++中嵌入python入门1
本人是用vc2003+python2.5学习的,其它的也应该差不了多少
0. 坏境设置
把python的include/libs目录分别加到vc的include/lib directories中去。另外,由于python没有提供debug lib,体地说,就是没有提供python25_d.lib了。你可 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号