Hi, I'm opening up text files created by another program which leaves an EOL character (which is a square box) to separate lines.
I'm reading through these files and extracting data from them, I know where my data starts because I know the name of the parameter eg. "FOOD TYPE", I do not however know how long the string is going to be before the ⌂ appears. So what I've done below is extend the string to beyond any possible answer, then search for the EOL character...
some of the following code has been changed for ease of understanding
if knownparameter in line: lineb = line #line will be used elsewhere found = lineb.find(knownparameter) #the index number of the occurance of parameter extractb = lineb[found:(found+30):1] #extractb is given a string to work with if ⌂ in extractb #if the EOL character is in the string end = extractb.find(⌂) #end is given the index of the EOL character extractb = lineb[found:end:1] #final string to save to extractb print extractb
The problem is that this will not run due to the EOL character being in my code...
what can I do to get around this?