ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Concordance/LFPToBegEnd.py
Revision: 473
Committed: Tue Oct 22 18:24:12 2013 UTC (12 years, 5 months ago) by nino.borges
Content type: text/x-python
File size: 943 byte(s)
Log Message:
Random code 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 473 contents = open(r'Y:\37354873\373540873_SPECIAL_PROJECTS.LFP').readlines()
15     outputFile = open(r'Y:\37354873\373540873_SPECIAL_PROJECTS.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()