zoukankan      html  css  js  c++  java
  • C# txt文档内容的事情

    Regex rgx = new Regex(@"http://www.XXXX.com/file/d{10}/");
     
    string path = @"H:", newTxt = @"H: ewTxt.txt";
     
                var query1 = from f in Directory.GetFiles(path)
                             let arr = File.ReadAllLines(f)
                             where f.EndsWith(".txt")
                             select new
                             {
                                 content = (from c in arr                                        
                                            where rgx.IsMatch(c)
                                            select c)
                             };
     
     
                query1.ToList().ForEach(item => File.AppendAllLines(newTxt, item.content));
     
                foreach (var str in File.ReadAllLines(newTxt))
                {
                    Console.WriteLine(str);
                }
  • 相关阅读:
    Python标准库--abc模块
    Python标准库--argparse模块
    爬虫基础
    jQuery基础
    前端基础之javascript
    web前端之HTML
    MySQL常用语句
    多线程和多进程
    socket网络编程
    异常处理
  • 原文地址:https://www.cnblogs.com/tested/p/3359128.html
Copyright © 2011-2022 走看看