ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Concordance/LFPToBegEnd.py
Revision: 342
Committed: Thu Apr 25 12:53:42 2013 UTC (12 years, 11 months ago) by nino.borges
Content type: text/x-python
File size: 1067 byte(s)
Log Message:
small updates

File Contents

# User Rev Content
1 ninoborges 8 """
2     LFPToBegEnd.py
3    
4     Created by Emanuel Borges
5     3.26.07
6    
7     This program will take an LFP file and make a file of just the BegNo, EndNo.
8    
9     """
10    
11     if __name__ == '__main__':
12     """This needs to be updated BEFORE you have an LFP with some docs that only have one page..."""
13    
14 nino.borges 342 contents = open(r'\\lisdisdss01\DIS29\C_D\542420041\0542420041_WEST_TENN_REUNITIZE\DATA\0542420041_WEST_TENN_REUNITIZE.LFP').readlines()
15     outputFile = open(r'\\lisdisdss01\DIS29\C_D\542420041\0542420041_WEST_TENN_REUNITIZE\DATA\0542420041_WEST_TENN_REUNITIZE.DAT','w')
16 ninoborges 8 preBates = ""
17     begNo = ""
18     for line in contents:
19     lineList = line.split(",")
20     bates = lineList[1]
21     parent = lineList[2]
22     if parent == 'D':
23     if begNo:
24     outputFile.write(begNo + "," + preBates + "\n")
25     else:
26     outputFile.write("BegNo,EndNo\n")
27     begNo = bates
28     preBates = bates
29     # flush the remaining document
30     outputFile.write(begNo + "," + preBates + "\n")
31     outputFile.close()