Python读取txt文件,有两种方式: (1)逐行读取 data=open("data.txt") line=data.readline() while line: print line line=data.readline() (2)一次全部读入内存 data=open("data.txt") for line in data.readlines(): print line
//1.打开资源管理器 OpenFileDialog open = new OpenFileDialog(); if (open.ShowDialog() == DialogResult.OK) { textBox1.Text =open.FileName; } //传入txt文件路径参数 读取txt文件所有内容 返回DATATABLE public DataTable GetTxt(string pths) { StreamReader sr = new S