lines = lines.lstrip()
for i in range(1, len(lines)): lines[i] = lines[i][margin:]
- # Remove any trailing or leading blank lines.
- while lines and not lines[-1]:
+ # Remove any leading blank lines.
while lines and not lines:
+ # make sure there is an empty line at the end
+ if lines and lines[-1]: