(all,out,i) = ("","",0)\x0d while 1:\x0d try:\x0d all = all+"\n"+raw_input("")\x0d except:\x0d break\x0d lines = all.split("\n")\x0d lines.remove("")\x0d for line in lines:\x0d if i == len(lines)-1:\x0d lastline = line\x0d else:\x0d out = out+"\n"+line\x0d i = i+1\x0d print lastline+out
Note that non-ascii characters in the above source code will be escaped (such as \x9f).