1,函数的参数 1.1,查看函数的参数类型 def run(a, *args, b, **kwargs): return a + b 可以通过如下方式查看参数类型: import inspect k = inspect.signature(run) for i, j in k.parameters.items(): print('{:7}:'.format(i) , j.kind) 输出结果为: a : POSITIONAL_OR_KEYWORD args : VAR_POSITIONAL b…
一.查找数列重复元素---count() >>> list = [,,,,,,,,,,,] >>> set = set(list) >>> for item in set: print("the %d has found %d" %(item,list.count(item))) #输出 #the has found #the has found #the has found #the has found 二.查找重复元素,使用 C…
17.进程线程 进程间通信方式:管道Pipe:队列Queue:共享内存Value.Array.Manager: 多进程同步:锁Lock.递归锁RLock.Condition(条件变量):事件event:信号signal:信号量Semaphore: 函数方式 from multiprocessing import Process import time import os def test(sub_p): for j in range(20): print('%s----pid=%s' % (su…