Threading模塊
http://python.jobbole.com/81546/
Threading.thread(target,name,args,kwargs)
Threading.Lock.aquire() Threading.Lock.lock.release() 鎖
Thread.name Thread.isAlive
Thread.startup()
Thread.join(timeout) 阻塞,直到線程結束或超時
join方法,如果一個線程或者一個函數在執行過程中要調用另外一個線程,並且待到其完成以後才能接着執行,那麼在調用這個線程時可以使用被調用線程的join方法。
是主進程挨個調用子線程的join()方法。當四個線程都執行完畢後,主線程纔會執行下面的代碼
setDaemon()
這個方法基本和join是相反的
只要主線程完成了,不管子線程是否完成,都要和主線程一起退出,
threading.Condition
condition.wait(timeout) condition.notify() condition.notifyAll()
threading.Event threading.Timer
2.Threading函數 調用另一個函數參數(pythings->threading->exercise)
http://www.zhihu.com/question/28127613/answer/39509912
global 變量,self.xxx 變量,callback函數,self._xxx 變量 ...
3. python 調用tcl函數,並引用tcl終端變量
http://liangqiu.blog.51cto.com/4461709/786898
然後是python調用tcl:
#!/usr/bin/python
from Tkinter import Tcl
#建立一個tcl的解釋器
tcl = Tcl()
#導入tcl文件
tcl.eval('source helloworld.tcl')
#調用函數,tcl_str爲返回值
tcl_str=tcl.eval('Factorial %d' % 10)
print tcl_str
4.OS
os.path.isdir('./file') os.path.exists('ss.txt')
os.mkdir('C:\\ x\x ') os.mkdir('./file')
os.popen('shell command')
os.listdir('//192.168.0.102/SharedDocs')
os.system( 'ipconfig')
5.random
from random import randint
randint(a,b) random() -> x in the interval [0, 1).
6.python調用py腳本 爲xxx,py 中的變量賦值,同時調用xxx的類和函數
xxx.py class cxx() def __init__(self,arg) def func()
import xxx
x = xxx.cxx(arg)
7.排序
l.sorted()
sorted(dict.iteritems(),key=lambda d:d[1],reverse=True)
8.re 正則表達式
http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html
9.BeautifulSoup
http://cuiqingcai.com/1319.html
10.requests
s=requests.get(url) s.text s.encoding = 'utf-8'
11.xlrd, xlwt, xlutils, pywin32 to Excel
http://www.2cto.com/kf/201408/322437.html
http://blog.csdn.net/tianzhu123/article/details/7225809
pywin32 to Excel
http://blog.csdn.net/qdx411324962/article/details/44270455
12.