zoukankan      html  css  js  c++  java
  • 在txt文本后追加内容

     public void CheckLog(string Log)
          {
                 if (File.Exists(LogFile))
                  {
                        WriteLog(Log);
                   }

                   else
                    {
                        CreateLog();
                        WriteLog(Log);
                   }
                }

             private void CreateLog()
               {
                    StreamWriter SW;
                    SW = File.CreateText(LogFile);
                    SW.WriteLine("Log created at: " +
                                         DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss"));
                    SW.Close();
               }

               private void WriteLog(string Log)
               {
                    using (StreamWriter SW = File.AppendText(LogFile))
                    {
                        SW.WriteLine(Log);
                        SW.Close();
                    }
               }

  • 相关阅读:
    elementui form 相关表单验证
    函数注释备注
    elementui elform 某一值为数组,各项必填验证
    selenium等待的三种方式(详细)
    什么是python
    pytest基础
    pymysql数据库操作
    自动化测试1
    allure生成测试报告
    python读取excel的文件
  • 原文地址:https://www.cnblogs.com/gates/p/3549044.html
Copyright © 2011-2022 走看看