1.python语言简单、方便,其内部可以快速实现排列组合算法,下面做简单介绍、

2.一个列表数据任意组合

2.1主要是利用自带的库

#_*_ coding:utf-8 _*_
#__author__='dragon'
import itertools
list1 = [1,2,3,4,5]
list2 = []
for i in range(1,len(list1)+1):
iter = itertools.combinations(list1,i)
list2.append(list(iter))
print(list2)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

3.排列的实现

#_*_ coding:utf-8 _*_
#__author__='dragon'
import itertools
list1 = [1,2,3,4,5]
list2 = []
for i in range(1,len(list1)+1):
iter = itertools.permutations(list1,i)
list2.append(list(iter))
print(list2)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

可以根据你需要随意组合

最新文章

  1. GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11
  2. SQL JOIN\SQL INNER JOIN 关键字\SQL LEFT JOIN 关键字\SQL RIGHT JOIN 关键字\SQL FULL JOIN 关键字
  3. MAC中Django中runserver提示Can't connect to local MySQL server through socket '/tmp/mysql.sock错误
  4. 【linux命令】grep
  5. jquery学习记录
  6. libevent使用
  7. MySQL基础学习之索引
  8. Oracle 行拼接 wmsys.wm_concat扩展
  9. 【OpenCV入门教程之一】 安装OpenCV:OpenCV 3.0、OpenCV 2.4.8、OpenCV 2.4.9 +VS 开发环境配置
  10. 第三代搜索推出网民评价系统,seo末日还会远吗?
  11. Windows Phone – 裁剪图片 (Crop Image)
  12. 捕鱼达人代码例子下载地址 mac版
  13. ZJOI2017 day1滚粗记
  14. Mac和Windows系统下Mysql数据库的导入导出
  15. django捡破烂
  16. ubuntu sudoers配置错误
  17. 【python接口自动化-requests库】【三】优化重构requests方法
  18. what's the 场外交易
  19. SpringMVC(前端设计模式)简介
  20. 【MFC】OnInitDialog

热门文章

  1. pycharm专业版(window)安装
  2. python 之九九乘法表
  3. 4 python内置函数
  4. UI5-学习篇-2-Hello World
  5. c++ cout cin, 命名空间
  6. ICE中间件相关
  7. oc NSLog输出格式大全
  8. Python 列表表达式 ,迭代器(2) Yield
  9. FastDFSClient工具类 文件上传下载
  10. vmware虚拟机桥接模式不能上网