V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
holajamc
V2EX  ›  Python

求教一个 gevent 相关问题

  •  1
     
  •   holajamc · 2016-11-24 11:22:56 +08:00 · 1677 次点击
    这是一个创建于 2711 天前的主题,其中的信息可能已经有所发展或是发生改变。

    在使用 gevent 时候真的很佩服它的强大,但是在使用中有一个问题一直比较头疼,如图:

    不知道有没有什么更好的写法~

    7 条回复    2016-11-29 10:05:11 +08:00
    mgna17
        1
    mgna17  
       2016-11-24 11:32:57 +08:00   ❤️ 1
    比如。。。用列表生成式么
    [gevent.spawn(item) for item in tmp]
    NaVient
        2
    NaVient  
       2016-11-24 14:36:50 +08:00   ❤️ 1
    楼主应该才开始写 python
    ```python
    gevet.joinall([gevent.spawn(tmp[i]) for i in range(5)])
    ```
    hastelloy
        3
    hastelloy  
       2016-11-24 18:18:07 +08:00 via Android   ❤️ 1
    我不厚道的觉得楼主不但刚学 python ,而且是刚学编程,怎么的也可以是 for i.. : temp[i]吧
    est
        4
    est  
       2016-11-24 18:22:03 +08:00   ❤️ 1
    gevent.pool
    holajamc
        5
    holajamc  
    OP
       2016-11-25 09:14:55 +08:00
    @mgna17
    @NaVient
    @hastelloy
    @est
    谢谢各位回复,刚刚学习 Python 不久~
    GeekGao
        6
    GeekGao  
       2016-11-25 17:54:30 +08:00   ❤️ 1
    holajamc
        7
    holajamc  
    OP
       2016-11-29 10:05:11 +08:00
    @GeekGao 谢谢指点~
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2866 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 09:40 · PVG 17:40 · LAX 02:40 · JFK 05:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.