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
相关文档:
Script Name: Spider_Create
#Script Label: Create Spider Diagrams
#
#Description: Custom python script developed to create spider diagrams from points contained
#in one or two feature classes. If using two fea ......
真是倒霉,刚买不久的移动硬盘,昨天删除一个分区失败后,几个分区都不见了,拿去修,未果
换了个新的,但其中数据全没了。那是我平时收集的很有用的资料
很多都可以重新下载,但怎能想起硬盘中的所有东西
今天换硬盘回来
就像写一个保存指定路径下所有文件夹和文件名的程序
这样,如果东西丢了,看看那里有些什么,也 ......
multiprocessing — Process-based “threading” interface
Introduction
multiprocessing is a package that supports spawning processes using an API similar to the threading module. The multiprocessing package offers both local and remote concurrency, effectively side-stepping the Glo ......