python调用tt

把附件图片的jpg改成pdf,为tt的电子书
---------------------------
pytyrant

apt-get install python-setuptools
apt-get install python-pytyrant
apt-get install python-memcache

下面这个好使
svn checkout http://pytyrant.googlecode.com/svn/trunk/ pytyrant-read-only

python setup.py install




------------------命令行的快捷键

http://www.dbanotes.net/techmemo/shell_shortcut.html
#!/usr/bin/env python
#hello_threads.py
import os
import pytyrant
import threading
import time
class ThreadClass(threading.Thread):
    def __init__(self,mycount):
        threading.Thread.__init__(self)
        self.t=pytyrant.PyTyrant.open("10.1.224.171",11211)
        self.mycount=mycount
    def run(self):
     #   tbegin=time.time();
        for k in range(50000):
            self.t["dalibai"+str(k)+"o"+str(self.mycount)]=str(k)
     #   print time.time() - tbegin
def main():
    tbegin=time.time();
    print tbegin
    for i in range(2000):
        t = ThreadClass(i)
        t.start()
    print "main:"+str(time.time() - tbegin);
if __name__=="__main__":
    main()


import pytyrant;
import time;
t=pytyrant.PyTyrant.open("10.1.224.171",11211)
tbegin=time.time();
for i in xrange(5000000):
    if i and ((i%1000000)==0):
        print time.time() - tbegin;
        tbegin=time.time();
    t["ningt87"+str(i)+"mm"]=str(i)

-----------------------发现tt自带测试程序------

ulimit -SHn 512000
tcrtest write -port 11212 -cnum 768 10.1.224.171 99999999
lsof -c tcrtest|wc -l

你可能感兴趣的:(python,SVN,Google)