随机打乱list | shuffle list

Python

import random

l = [1,2,3,4]
random.shuffle(l)
print l
[2, 1, 4, 3]

Leave a Comment

Your email address will not be published.