trimming by blackneyed

import sys\x0d
lines = sys.stdin.readlines()\x0d
first = [i for i, s in enumerate(lines) if len(s.strip()) > 0][0]\x0d
lines = lines[first:]\x0d
min_ltrim = min((len(s)-len(s.lstrip()) for s in lines))\x0d
min_rtrim = min((len(s)-len(s.rstrip()) for s in lines))\x0d
print "\n".join((s[min_ltrim:-min_rtrim] for s in lines))

Note that non-ascii characters in the above source code will be escaped (such as \x9f).


return to the top page