小编hmm*_*hmm的帖子

Python 3 - 使用多次选择

如何在单个命令行中多次使用"选择".我想使用命令'choice',如下所示 -

>>> l
['9', '10', '1', '2', '3']
>>> choice(l)
'2'
>>> choice(l)*3
'222'
Run Code Online (Sandbox Code Playgroud)

我需要生成三个不同的值,l而不是相同数量的三倍.

python python-3.x

-3
推荐指数
1
解决办法
116
查看次数

标签 统计

python ×1

python-3.x ×1