|
|
@ -31,3 +31,20 @@ def updateFile(file, old_str, new_str):
|
|
|
|
os.rename("%s.bak" % file, file)
|
|
|
|
os.rename("%s.bak" % file, file)
|
|
|
|
f2.close()
|
|
|
|
f2.close()
|
|
|
|
f1.close()
|
|
|
|
f1.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateFile(r"test.txt", ";", "。")
|
|
|
|
|
|
|
|
updateFile(r"test.txt", ":", ":")
|
|
|
|
|
|
|
|
updateFile(r"test.txt", "-", "--")
|
|
|
|
|
|
|
|
updateFile(r"test.txt", "确诊病例", "")
|
|
|
|
|
|
|
|
updateFile(r"test.txt", "病例轨迹", "")
|
|
|
|
|
|
|
|
updateFile(r"test.txt", "病例", "&&病例")
|
|
|
|
|
|
|
|
updateFile(r"test.txt", "呼和浩特市应对新型冠状病毒感染", "end")
|
|
|
|
|
|
|
|
data = openreadtxt('test.txt')
|
|
|
|
|
|
|
|
data = str(data)
|
|
|
|
|
|
|
|
result = re.findall("病例\d:.*?(?=&&|end)", data)
|
|
|
|
|
|
|
|
name = []
|
|
|
|
|
|
|
|
date = []
|
|
|
|
|
|
|
|
time = []
|
|
|
|
|
|
|
|
through = []
|
|
|
|
|
|
|
|
Num = 0
|
|
|
|
|
|
|
|
for i in result:
|