字母数字穷举排列组合域名,位数递增,网络爬虫,网页抓取

        List<List<string>> res = Generate("abcdefghijklmnopqrstuvwxyz0123456789-");
            Console.WriteLine("Count = " + res.Count);
            for (int i = 0; i < res.Count; i++)
            {
                Console.WriteLine(res[i]);
            }

        public static List<List<string>> Generate(string word)
        {
           List<List<string>> result = new List<List<string>>();

           List<string> dList = new List<string>();
            foreach (char i in word)
            {
                dList.Add(i.ToString());
            }
            result.Add(dList);

            int a = 0;

            do
            {
                result.Add(GetNext(word, result[a]));
                a++;
            } while (a < result.Count);
            
            return result;
        }
        private static List<string> GetNext(string word, List<string> list)
        {
            List<string> dList = new List<string>();

            int count = list.Count;
            for (int i = 0; i < word.Length; i++)
            {
                for (int a = 0; a < count; a++)
                {
                    dList.Add(word[i].ToString() + list[a]);
                }
            }

            return dList;
        }

输出格式:
a,b,c,……

aa,ab,ac,……
ba,bb,bc,……
ca,cb,cc,……

aaa,aab,aac,……aba,abb,abc,……aca,acb,acc,……
baa,bab,bac,……bba,bbb,bbc,……bca,bcb,bcc,……
caa,cab,cac,……cba,cbb,cbc,……cca,ccb,ccc,……

aaaa,aaab,aaac,……aaba,aabb,aabc,……aaca,aacb,aacc,……

网页抓取、网络爬虫效果图:

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值