ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Concordance/LFPToBegEnd.py
Revision: 8
Committed: Sat May 5 04:21:19 2012 UTC (13 years, 10 months ago) by ninoborges
Content type: text/x-python
File size: 1037 byte(s)
Log Message:
Initial Import

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     contents = open(r'\\Lisdisdss01\dis29\C_D\_mkl_working\DX0698 - DX0936\DX0698_DX0936\DATA\DX0698_DX0936.LFP').readlines()
15     outputFile = open(r'\\Lisdisdss01\dis29\C_D\_mkl_working\DX0698 - DX0936\DX0698_DX0936\DATA\DX0698_DX0936.DAT','w')
16     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()