一.调用PC端默认方式打开本地文件 在main.js里 // 打开系统本地文件或者网页链接 const {shell} = require('electron'); // Open a local file in the default app var path1 = "d:\\ProjectsSpace\\ElectronProjects\\ElectronTest2\\app\\html\\config\\record.txt"; shell.openItem(path1); //
读写文本文件 使用C#读写文本文件需要5个步骤: 1.创建文件流 2.创建阅读器或者写入器 3.执行读写操作 4.关闭阅读器或者写入器 5.关闭文件流 例 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; //引入命名空间 namespace Demo { class Program
Python操作文件和目录 读写文件比较简单,有一点特别注意就好了 windows下Python默认打开的文件以gbk解码,而一般我们的文件是utf-8编码的,所以如果文本含有中文,就会出现异常或者乱码.此时手动添加encoding='utf-8'表示以utf-8的方式打开. 当然Python写入时候,也是默认以gbk的编码写入.而文件通常是utf-8格式保存的,所以若不指定写入的编码方式,一写入中文就是乱码了 with open('abc.txt', encoding='utf-8') as