- i need to get a text file fro given .tst file... and find number of lines in it
- I'm getting 0 as output..
- I Need to execute program twice for getting those text files
- Is there a problem with my code??
name_of_file = raw_input("tst file address please:")
import re
f = open(name_of_file+".tst",'r')
data = f.read()
y = re.findall(r'Test Case:(.*?)TEST.UNIT:',data,re.DOTALL)
fb = open('tcases.txt' ,'w' )
for line in y :
fb.write(line)
z = re.findall(r'TEST.SUBPROGRAM:(.*?)TEST.NEW',data,re.DOTALL)
fc = open('tsubprgs.txt' ,'w' )
for line in z :
fc.write(line)
x = re.findall(r'TEST.UNIT:(.*?)TEST.SUBPROGRAM:',data,re.DOTALL)
fa = open('tunits.txt' ,'w' )
for line in x :
fa.write(line)
with open('tunits.txt') as foo:
lines = len(foo.readlines())
print lines