为给定的长度和字符集生成所有可能的排列 [英] Generating all possible permutations for a given length and set of characters

查看:22
本文介绍了为给定的长度和字符集生成所有可能的排列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将这个使用 itertools 库的 Python 函数转换为 VB.Net:

I'm trying to convert this Python function, which uses the itertools library, to VB.Net:

permutations = itertools.product('ab', repeat=3)

以上函数返回所有排列:

The above function returns all permutations:

[['a','a','a'],
 ['a','a','b'],
 ['a','b','a'],
 ['a','b','b'],
 ['b','a','a'],
 ['b','a','b'],
 ['b','b','a'],
 ['b','b','b']]

在 VB.Net 中是否有一种干净的方法可以做到这一点?

Is there a nice clean way to do this in VB.Net?

推荐答案

如果我没记错的话,你的问题的答案.- https://stackoverflow.com/a/21090635/2319909

The answer to your question, if I'm not mistaken. - https://stackoverflow.com/a/21090635/2319909

这篇关于为给定的长度和字符集生成所有可能的排列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆