Hide keyboard shortcuts

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 18: get_final_line""" 

3 

4 

5def get_final_line(filename): 

6 """Given a filename, returns the final line in that file.""" 

7 final_line = '' 

8 for current_line in open(filename): 

9 final_line = current_line 

10 return final_line