Compare commits

...

12 Commits
f1 ... master

@ -48,7 +48,7 @@ time = []
through = [] through = []
Num = 0 Num = 0
for i in result: for i in result:
NUM = 0 NUM = 0
f = open('20.txt', 'w', encoding="utf-8") f = open('20.txt', 'w', encoding="utf-8")
f.write(i) f.write(i)
f.close() f.close()
@ -58,12 +58,11 @@ for i in result:
getOne = re.findall("\d{1,2}月\d{1,2}?日.*?。+(?=\d{1,2}月\d{1,2}日)|\d{1,2}月\d{1,2}?日.*?。+(?=病例)", data) getOne = re.findall("\d{1,2}月\d{1,2}?日.*?。+(?=\d{1,2}月\d{1,2}日)|\d{1,2}月\d{1,2}?日.*?。+(?=病例)", data)
numname = 0 numname = 0
for i in getOne: for i in getOne:
NUM += 1 NUM += 1
f = open('10.txt', 'w', encoding="utf-8") f = open('10.txt', 'w', encoding="utf-8")
f.write(i) f.write(i)
f.close() f.close()
data = openreadtxt("10.txt") data = str(data)
data = str(data)
date1 = re.findall("\d{1,2}月\d{1,2}日+(?=)", data)[0] date1 = re.findall("\d{1,2}月\d{1,2}日+(?=)", data)[0]
date1 = date1.split() date1 = date1.split()
time += re.findall("\d{1,2}:\d{1,2}--\d{1,2}:\d{1,2}|\d{1,2}:\d{1,2}", data) time += re.findall("\d{1,2}:\d{1,2}--\d{1,2}:\d{1,2}|\d{1,2}:\d{1,2}", data)
@ -80,16 +79,16 @@ for i in result:
while x < numdate: while x < numdate:
date += date1 date += date1
x += 1 x += 1
i = 0 i = 0
name2 = name1[0].split() name2 = name1[0].split()
while i < numname: while i < numname:
name += name2 name += name2
i += 1 i += 1
num = range(0, Num) num = range(0, Num)
rows = zip(num, name, date, date, time, through) rows = zip(num, name, date, date, time, through)
with open("test.csv", "w", encoding='utf-8', newline="") as t: with open("test.csv", "w", encoding='utf-8', newline="") as t:
writer = csv.writer(t) writer = csv.writer(t)
writer.writerow(["", "病例", "开始日期", "结束日期", "时间", "事件"]) writer.writerow(["", "病例", "开始日期", "结束日期", "时间", "事件"])
for row in rows: for row in rows:
writer.writerow(row) writer.writerow(row)
t.close() t.close()

Loading…
Cancel
Save