add md_csv directory
This commit is contained in:
parent
b9b989f206
commit
a7abf541ad
3
scripts/md_csv/csv2md.py
Normal file
3
scripts/md_csv/csv2md.py
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
|
23
scripts/md_csv/md2csv.py
Normal file
23
scripts/md_csv/md2csv.py
Normal file
@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import re
|
||||
|
||||
TOKEN_REGEX = r"""(\d+)(-)(\d+)(\.)(.+)"""
|
||||
TOKEN_REGEX2 = r"""(\|)(\s*)([^\s]*)(\s*)(\|)(\s*)([^\s]*)(\s*)(\|)(\s*)([^\s]*)(\s*)(\|)(\s*)([^\s]*)(\s*)(\|)"""
|
||||
|
||||
def md2csv(mdfile):
|
||||
state = 0
|
||||
for line in open(mdfile).readlines():
|
||||
match = re.match(TOKEN_REGEX, line)
|
||||
if match:
|
||||
logclass1, _, logclass2, _, title = match.groups()
|
||||
state = 1
|
||||
# print(logclass1, logclass2, title)
|
||||
continue
|
||||
match2 = re.match(TOKEN_REGEX2, line)
|
||||
if match2:
|
||||
_, _, field1, _, _, _, field2, _, _, _, field3, _, _, _, field4, _, _, = match2.groups()
|
||||
print(field1, field2, field3, field4)
|
||||
|
||||
|
||||
md2csv('/root/opensource/doc/api说明/gamelog.md')
|
Loading…
x
Reference in New Issue
Block a user