Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1#!/usr/bin/env python3
2"""Solution to chapter 5, exercise 24: reverse_lines"""
3
4
5def reverse_lines(infilename, outfilename):
6 with open(infilename) as infile, open(outfilename, 'w') as outfile:
7 for one_line in infile:
8 outfile.write(f'{one_line.rstrip()[::-1]}\n')