注意:乘法的优先级高,在计算器输入时要加括号!
代码:
import win32api,win32gui, win32con
import win32comclient
shell = win32comclientDispatch("WScriptShell")
shellRun("calc")
win32apiSleep(1000)
shellSendKeys("200{+}")
win32apiSleep(1000)
shellSendKeys("{(}100\x2a2{)}")
win32apiSleep(1000)
shellSendKeys("-22")
win32apiSleep(1000)
shellSendKeys("=")
h = win32guiFindWindow("SciCalc", None)
edit = win32guiFindWindowEx(h, None, 'Edit', None)
bufLen = 1024
buf = win32guiPyMakeBuffer(bufLen)
n = win32guiSendMessage(edit, win32conWM_GETTEXT, bufLen, buf)
print buf[0:n]
win32apiSleep(1000)
win32guiSendMessage(h, win32conWM_SYSCOMMAND, win32conSC_CLOSE, 0);
运行结果:
378脑子笨,口算子网掩码有点慢,于是用python3 写了个子网掩码计算器,可以算IPV4和IPV6,支持19216811/24和19216811/2552552550两种掩码方式。
脚本内容如下:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)