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…
s = [] f = open('querylist.txt','r') #由于我使用的pycharm已经设置完了路径,因此我直接写了文件名 for lines in f: ls = lines.strip('\n').replace(' ','').replace('.','/').replace('?','').split('/') for i in ls: s.append(i) f.close() print(s) ===================…