Menu
Coddy logo textTech

Open

Lesson 2 of 12 in Coddy's File Handling in Python course.

To start making operations on file, you should first open it.

To open a file in Python use the open() function:

f = open("hello.txt")
challenge icon

Challenge

Easy

Open the file named coddy.txt, and store it in a variable named f.

The content of the file is I'm learning Python on Coddy, if you successfully store the open file in variable f, we will read the content and print it!

Try it yourself

# Write code here

All lessons in File Handling in Python