Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Regular Expressions in Python Introduction to Regular Expressions The Basics

Task 2 of 5 Read the contents of file_object into a new variable named data. May someone please read my code

Please help

basics.py
with open('basics.txt') as file:
    data = file_object.read()
    file_object.close()

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Sinazo Nongena! You're doing fine, but something happened between step 1 and step 2 here.

Right now, you have this:

with open('basics.txt') as file:

But opens a file and saves it to the variable file. It should be named file_object as stated in Step 1. So you need:

with open('basics.txt') as file_object:

The rest of your code is fine so far!

Hope this helps! :sparkles:

Thank you for your assistance:)