• Python 多线程 类和方法


    import threading
    import time
    import random
    
    def threadFun():
        for i in range(10):
            print("ThreadFun - %d" %i)
            time.sleep(random.randrange(0,2))
    
    class ThreadClass(threading.Thread):
        def __init__(self):
            threading.Thread.__init__(self)
    
        def run(self):
            for i in range(10):
                print("ThreadClass - %d" %i)
                time.sleep(random.randrange(0,2))
    
    if __name__ == "__main__":
        tFunc = threading.Thread(target = threadFun)
        tCls = ThreadClass()
        tFunc.start()
        tCls.start()
        tFunc.join()
        tCls.join()
  • 相关阅读:
    bash特性
    FHS 层级文件系统
    环境变量的问题
    linux认识
    搜索引擎的使用
    nginx
    部署操作手册
    git
    添加tag
    pycharm中使用git
  • 原文地址:https://www.cnblogs.com/jachin/p/5531550.html
Copyright © 2020-2023  润新知