V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
911speedstar
V2EX  ›  Python

怎么随机休息几秒呢

  •  
  •   911speedstar · Mar 9, 2019 · 3158 views
    This topic created in 2610 days ago, the information mentioned may be changed or developed.
    原代码里是 time.sleep(5),

    怎么改为让程序随机休息几秒呢,比如这次循环是休息 1s,下次就 3s,下下次 5s。这样子的
    ClutchBear
        1
    ClutchBear  
       Mar 9, 2019   ❤️ 1
    random。randint ( 1,5 )
    Heyavc
        2
    Heyavc  
       Mar 10, 2019
    random 随机数
    wanderpoet
        3
    wanderpoet  
       Mar 10, 2019 via iPhone
    sleep + random
    yingfengi
        4
    yingfengi  
       Mar 10, 2019   ❤️ 2
    随机卡顿好下次优化吗 (狗头.gif )
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1217 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 17:15 · PVG 01:15 · LAX 10:15 · JFK 13:15
    ♥ Do have faith in what you're doing.