~cpp source = file("source.txt") fout = file("output.txt",'w') for line in source.readlines(): print >> fout,line[::-1] source.close() fout.close()