I have a bunch of data that looks like:
And need to get it into the form:
I wrote a little python script that usually works, but if there isn't a line-feed on the last line I lose the last two letters in that line. So the last line would look like "789 c". Is there a more intelligent way to get a line w/out line endings than editor.getLine(stride+i)[:-2])
editor.addText("\t" + editor.getLine(stride+i)[:-2])
i += 1
Although I don't have any means of testing this currently, you should be able to use the rstrip() method for strings.
# instead of this
# use this
This will strip all whitespace and non printing characters from the right side of a string.
That works, thank you!
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.