Rumah >pembangunan bahagian belakang >Tutorial Python >使用python读取文件小程序
这篇文章介绍使用python读取文件小程序
os sys re xlwt Filelist = [] FileNum = bw = {} iops = {} (SubStrListStr): flag = substr SubStrList: (substr Str): flag = flag (startendstr): result = re.findall(+start++end+str) x result: x (): FlagStr = [] FileNum filename os.listdir(os.path.dirname(os.path.realpath(__file__))): (IsSubString(FlagStrfilename)): Filelist.append(filename) FileNum = FileNum + FileNum (filename): file = (filename) lst[] r=file.readline() (r) ==: r.count() ==(line): : lst.append(r) i lst: i (): i Filelist: ReadFile(i) (): wb = xlwt.Workbook() = wb.add_sheet() __name__==: GetFilelist() FileLoop()
Atas ialah kandungan terperinci 使用python读取文件小程序. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!