diff --git a/getdata.py b/getdata.py index b1cec63..291c59c 100644 --- a/getdata.py +++ b/getdata.py @@ -72,23 +72,23 @@ NUM = 0 data = str(data) t = re.findall("(?<=。)+.*?。", data) through += t - numdate = len(t) - Num += numdate - numname += numdate - x = 0 - while x < numdate: - date += date1 - x += 1 - i = 0 - name2 = name1[0].split() - while i < numname: + numdate = len(t) + Num += numdate + numname += numdate + x = 0 + while x < numdate: + date += date1 + x += 1 + i = 0 + name2 = name1[0].split() + while i < numname: name += name2 i += 1 -num = range(0, Num) -rows = zip(num, name, date, date, time, through) -with open("test.csv", "w", encoding='utf-8', newline="") as t: - writer = csv.writer(t) - writer.writerow(["", "病例", "开始日期", "结束日期", "时间", "事件"]) - for row in rows: + num = range(0, Num) + rows = zip(num, name, date, date, time, through) + with open("test.csv", "w", encoding='utf-8', newline="") as t: + writer = csv.writer(t) + writer.writerow(["", "病例", "开始日期", "结束日期", "时间", "事件"]) + for row in rows: writer.writerow(row) -t.close() \ No newline at end of file + t.close()