Home > Article > Backend Development > Use python to read files applet
This article introduces the use of python to read files
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()
The above is the detailed content of Use python to read files applet. For more information, please follow other related articles on the PHP Chinese website!