易截截图软件、单文件、免安装、纯绿色、仅160KB

python decorator

1.常用方法,不带参数
def decator(func):
    def inner_func(*args):
        args = (i * 2 for i in args)
        return func(*args)
    return inner_func
   
@decator
def add(a, b, c):
    return a + b + c
2.带参数:
class Dec(object):
    def __init__(self, i):
        self.i = i
    def __call__(self, func):
        def inner_func(a, b, c):
            return self.i * func(a, b, c)
        return inner_func
   
@Dec(2)
def abc(x, y, z):
    print "function abc"
    print (x, y, z)
    return x + y + z


相关文档:

网络校时 附Python源码及几个标准时间服务器

网络时间服务器 一般都遵循 RFC868 协议标准.
按该标准 附下面 Python 源码.
# -*- coding: utf-8 -*-
import socket,sys,time
#时间服务器
host = "stdtime.gov.hk"
#端口
port = 37
#时区
curtz = 8
#连接服务器,并接收返回
try:
host = socket.gethostbyname(host)
s = socket.socket(socket.AF_INET,soc ......

python 数据库

def Start(self):
        if (self.conn == None) or (self.conn.State == 1):
            self.conn = win32com.client.Dispatch(r'ADODB.Connection')
          &n ......

[Python module] queue

8.8. queue — A synchronized queue class¶
queue -- 一个同步队列类
The queue module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be exchanged safely between multiple threads. The Queue class in this module implemen ......

[Python module] threading

threading — Higher-level threading interface
This module constructs higher-level threading interfaces on top of the lower level _thread module. See also the queue module.
The dummy_threading module is provided for situations where threading cannot be used because _thread is missing.
  ......

写了几个有关operaminimod的python小程序

写了几个有关operaminimod的python小程序
firefox->opm书签转换
import re
def pipeiwangzhi(a):
    s=[]
    pp= re.compile(r'<DT><A HREF="(.*)" ADD_DATE=(.*>)(.*)</A>')
    m=pp.search(a)
    s1=[]
  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号