dst = "log/all.txt" # 生成文件目录
def splitFile(filePath):
with open(filePath, 'r', encoding='utf-8') as f:
line = f.readlines()
aline = [i for i in line if i.strip('\n')]
xx = 1
fw = None
for index, value in enumerate(aline):
if value.startswith('------------'):
if fw is not None:
fw.close()
fw = open('log/' + str(xx) + '.log', 'w', encoding='utf-8')
xx = xx + 1
else:
fw.write(value)
def read_log(filePath):
with open(filePath, 'r', encoding='utf-8') as f:
line = f.readlines()
aline = [i for i in line if i.strip('\n')]
for value in aline:
if len(value) > 0 :
print(value)
read_log('log/192.log')
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。