Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

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

2 Answers

Jennifer Nordell
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:)