如何将Python协程中的任务实例操作改写成长尾?
- 内容介绍
- 文章标签
- 相关推荐
本文共计495个文字,预计阅读时间需要2分钟。
python
1.添加任务 +task2=异步访问 URL('http://another.com', 3) 并运行异步执行 asynicio.run(task2)
2.这 2 个程序共同耗时 5 秒,记录左右时间的差异。
1、添加一个任务
task2 = visit_url('another.com', 3) asynicio.run(task2)
2、这 2 个程序一共消耗 5s 左右的时间。
本文共计495个文字,预计阅读时间需要2分钟。
python
1.添加任务 +task2=异步访问 URL('http://another.com', 3) 并运行异步执行 asynicio.run(task2)
2.这 2 个程序共同耗时 5 秒,记录左右时间的差异。
1、添加一个任务
task2 = visit_url('another.com', 3) asynicio.run(task2)
2、这 2 个程序一共消耗 5s 左右的时间。

