有个文件夹里面有很多的图片,都是.png格式的,要是一个一个的拖到脚本上觉得很麻烦,就写了一个遍历添加的cars,变量是List<Sprite> 代码如下: using UnityEngine; using System.IO; using System.Collections.Generic; public class NewBehaviourScript : MonoBehaviour { private List<Texture> cars = new List<Tex
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { DirectoryInfo theFolder = new Direc
最近需要使用统计一个目录下的所有文件,使用python比较方便,就整理了一下代码. import os def gci(filepath): files = os.listdir(filepath) for fi in files: fi_d = os.path.join(filepath,fi) if os.path.isdir(fi_d): gci(fi_d) else: str = os.path.join(filepath,fi_d)+'\n' suffix = str[-5:] pri
import os def iterbrowse(path): for home, dirs, files in os.walk(path): for filename in files: yield os.path.join(home, filename) for fullname in iterbrowse("文件夹目录"): if fullname.endswith('.py'): print(fullname)