import randomn=eval(input())m=list(range(1,n+1))print ("随机排序列表 : ", list)for i in range(0,n): random.shuffle(m) # shuffle函数是将原list打乱而不是返回一个新的list for j in range(0,n): print(m[j],end=' ') print() Author: Michelle19lLink: https://gitee.com/michelle19l/michelle19l/2020/05/25/list打乱/Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.pythonrandom.shuffle Donate微信支付寶Previous Postphp学习一 —— 基本语法Next Postphp学习二 —— 流程控制结构 Recommend 2021-04-16pytorch中引入mnist数据集 2021-03-31莫烦python pytorch学习 2020-05-08Python virtualenv使用 2020-04-30python大作业报告 2020-01-21利用argparse编写python命令行工具