标签:put imp input while txt lin int mpi mat
import re
inputFile = open(‘C:/Users/14526/Desktop/demo.txt‘)
outputFile = open(‘C:/Users/14526/Desktop/result.txt‘, ‘w‘)
pattern = re.compile(r"/\*\s-*\s150699_MBS_[\s\S]*_RPT\s-*\s\*/")
pattern2 = re.compile(r"/\*\s-*\s150699_[\s\S]*\s-*\s\*/")
flag = 0
while 1:
line = inputFile.readline()
if not line:
break
if pattern.match(line):
print(line)
outputFile.writelines(line)
print(1)
flag = 1
elif pattern2.match(line) and not pattern.match(line):
flag = 0
print(2)
else:
print(3)
if flag == 1:
print(4)
outputFile.writelines(line)
inputFile.close()
outputFile.close()
标签:put imp input while txt lin int mpi mat
原文地址:http://www.cnblogs.com/jiang-Xin/p/7631213.html