推荐学习书目
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
Zoeeeeecho
V2EX  ›  Python

Python 随机生成句子

  •  
  •   Zoeeeeecho · Sep 21, 2022 · 2205 views
    This topic created in 1358 days ago, the information mentioned may be changed or developed.
    苯人刚学 python ,作业要求以主谓宾三个部分 define 三个从列表里随机选一个元素的函数,最后组成主谓宾形式的句子并重复输出 10 次。我只会用 choice ()来随机从列表里选元素,想知道怎么 def 一个随机选元素的函数。苯人刚学,问的问题大多很蠢,大家见谅!谢谢大家帮助!
    3 replies    2022-09-22 09:53:10 +08:00
    Via8veritas
        1
    Via8veritas  
       Sep 21, 2022
    target_list[radom(0, len(target_list))]
    我理解是这样?
    还是说你想自己实现随机数的函数?
    fgwmlhdkkkw
        2
    fgwmlhdkkkw  
       Sep 21, 2022
    额,每个循环 choice3 次,循环 10 次。
    ruanimal
        3
    ruanimal  
       Sep 22, 2022
    感觉不是笨是懒
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   911 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 19:48 · PVG 03:48 · LAX 12:48 · JFK 15:48
    ♥ Do have faith in what you're doing.