C#创建记事本方法一://创建对象 FileStream stream = new FileStream(@"d:\aa.txt",FileMode.Create);//fileMode指定是读取还是写入 StreamWriter writer = new StreamWriter(stream); writer.WriteLine("123456");//写入一行,写完后会自动换行 writer.Write("abc");//写完后不会换行 w
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace textTest { public partial class WebForm1 : System.Web.UI.Page { p
TXT文件: txt是微软在操作系统上附带的一种文本格式,文件以.txt为后缀. 从txt文件中读取数据: with open ('xxx.txt') as file: data=file.readlines() 将数据写入txt文件: with open ('xxx.txt','a',encoding='utf-8') as file: file.write('xxxx') 注:a表示append,将数据一行行写入文件 JSON文件: JSON指JavaScript对象表示法(JavaScri