First page Back Continue Last page Overview Graphics

Reading a File

First we have to open the file for reading:

fileHandle = open('yellow_snow.txt')

Now we have a file handle „fileHandle“ pointing to the file.

Reading and printing the whole file is easy:

print(fileHandle.read())

When we don't need the file anymore, we close it:

fileHandle.close()