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 trialHabibur 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
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
Treehouse Moderator 68,457 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.