[本文出自天外归云的博客园] 脚本功能:在指定的路径下递归搜索,找出指定字符串在文件中出现的位置(行信息). 用到的python特性: 1. PEP 318 -- Decorators for Functions and Methods 2. PEP 380 -- Syntax for Delegating to a Subgenerator 3. PEP 471 -- os.scandir() function -- a better and faster directory iterator
本地路径的创建 在做下载操作时,我们一般先把文件下载到本地指定的路径下,然后再做其他使用. 为了防止程序出现异常,我们通常需要先判断本地是否存在指定的路径. 以C盘Tmp文件夹为例,我们可以这样做,代码如下: if not DirectoryExists('C:\Tmp') then if not CreateDir('C:\Tmp') then raise Exception.Create('Opps, Create New Dir Failed!'); 清空本地指定文件夹下的文件 以C盘Tm
using UnityEngine; using System.Collections; using System.Collections.Generic; using System.IO; <pre class="csharp" name="code"> public static List<string> nameArray = new List<string>(); /// <summary> /// 依据指定的