Python实现随机排序 使用shuffle()函数对列表实现随机排序 from random import shuffle name = ["a", "b", "c","d", "e"] shuffle(name) for i in name: print(i) for i, j in enumerate(name): name[i] = (i + 1).__str__() + ':' + j.__str__() print("---随机顺序---") for i in name: print(i) 运行结果如图: