如何用python实现随机抽取

如题所述

1
2
3
4

import random
l=[1,2,3,4,5,6,7,8,9,0]
x=random.choice(l)
#x是l中随机抽取的一个元素
温馨提示:答案为网友推荐,仅供参考
相似回答