p = [
"Python",
"is",
"powerful",
"simple",
"and so on..."] 2 3 random.shuffle(p) 4 5 print p 6 7 #---- 结果(不同机器上的结果可能不一样。) 8 9 #[‘powerful‘, ‘simple‘, ‘is‘, ‘Python‘, ‘and so on...‘] 10 11p = [
"Python",
"is",
"powerful",
"simple",
"and so on..."] random.shuffle(p)
printp
#---- 结果(不同机器上的结果可能不一样。) #[‘powerful‘, ‘simple‘, ‘is‘, ‘Python‘, ‘and so on...‘]来源: http://www.bubuko.com/infodetail-2353511.html