list = [1, 2, 3, 4, 5]
#随机选取
print random.choice(list)
#随机打乱
random.shuffle(list)
print list
输出
复制代码 代码如下:
0.787074152336
95
1
[4, 5, 2, 3, 1]
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn