# FileprintAlternative.py Copyright (c) Kari Laitinen # http://www.naturalprogramming.com # 2006-05-14 File created. # 2022-12-18 Converted to Python 3. # An alternative version of program Fileprint.py print( "\n This program prints the contents of a text" \ "\n file to the screen. Give a file name: ", end="" ) file_name_from_user = input() file_to_print = open( file_name_from_user, 'r' ) line_counter = 0 for text_line in file_to_print : print( text_line, end="" ) line_counter += 1 file_to_print.close() print( "\n %d lines printed." % line_counter )