• 2023-03-24python gevnt实现协程
    gevent也是第三方库,自行调度协程,自动试别程序的耗时操作。比如读文件,等待时间。代码举了个栗子fromgeventimportmonkeymonkey.patch_all()importtimeimportgev
  • 2023-03-23python 协程 第三方greenlet
    1.greenlet自行执行的微线程https://greenlet.readthedocs.io/en/latest/greenlet.html 2.终端安装pipinstallgreenlet 3.举个栗子importtimefromgree
  • 2023-03-23python 协程
    1.协程定义不开辟新的线程的基础上,实现多个任务,是个特殊的生成器。一秒钟能切换上百次。2.原始版协程importtime#1.work1生成器defwork1():whileTrue: