| 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 |
186 |
contents = open(r'\\lisdisdss01\dis29\C_D\PizzaHut\Pizzahut.lfp').readlines()
|
| 15 |
|
|
outputFile = open(r'\\lisdisdss01\dis29\C_D\PizzaHut\Pizzahut.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() |