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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Habibur Rahman Dipto](https://secure.gravatar.com/avatar/843a9b9dd7e445fd0aeac8697daed719?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Habibur Rahman Dipto
8,496 PointsHow i can solve the extra credit
Add a "SAVE" option to your script. Use the open function to open a file and save your shopping list to it.
Then use a for loop on the file to read each line in the file. Add each line to your shopping_list variable when your file first runs.
Your list is now more permanent!
I have no idea how work with open. Anyone Please help me
2 Answers
![Kenneth Love](https://uploads.teamtreehouse.com/production/profile-photos/710512/micro_TeacherShoot-Kenneth.jpg)
Kenneth Love
Treehouse Guest TeacherExtra credit isn't something we validate or anything like that, it's purely work you can do, on your own, to learn more. We have used open()
in a few courses, IIRC, but nothing you've done at this point, so I won't refer you to them. But there are links there for the Python docs, so read those and play around. You might be surprised what you can figure out and guess about at this point!
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsI don't recall a specific Treehouse Python course that covers file input/output. Perhaps Kenneth Love knows better.
There are some hints in the Python Docs on open()
. The Python docs also have a tutorial on input and output.