这篇文章介绍使用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社区 其它相关文章!