這篇文章介紹使用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()
以上是使用python讀取檔案小程式的詳細內容。更多資訊請關注PHP中文網其他相關文章!