In [2]:
from warehouse import LINEFEED
from HOFs import *

In [37]:
lines = ["""   IF *PF-KEY                       EQ   'PF3' OR= 'PF15' OR= 'PF17'"""]

In [55]:
line = """   IF *PF-KEY                       EQ   'PF3' OR= 'PF15' OR= 'PF17'"""

In [74]:
wrd1 = 'OR='
lw = len(wrd1)
idx = line[lw:].index(wrd1)+2
wrd1 + ' ' + line[lw:idx]
ll = len(wrd1 + ' ' + line[lw:idx])
line[ll:]


Out[74]:
"OR= 'PF17'"

In [57]:
wrd1 = word(line, 1)
wrd1


Out[57]:
'OR='

In [35]:
for line in lines:
        wrd = words(line)
        for w in xrange(1, wrd[0]):
            if wrd[1][w] in LINEFEED:
                joinLines.append(wrd[1][w] + ' ' + line[len(wrd[1][w]):]line.index(wrd[1][w])])
                line = line[line.index(wrd[1][w]):]
        joinLines.append(line)

In [36]:
joinLines


Out[36]:
["OR= IF *PF-KEY                       EQ   'PF3' ",
 'OR= ',
 "OR= 'PF15' OR= 'PF17'"]

In [ ]: