Listing 09-01: Opening, reading, and closing a File

##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 09\09.01 - Opening, reading, and closing a File.py
# Description: Opening, reading, and closing a File
##############################################################################

file = open("numbers.txt", "r")
for line in file.readlines():
    print(line)
file.close()
Click here to download the file