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 Python Basics (2015) Python Data Types Lists

Alexander Hansson
Alexander Hansson
2,083 Points

Databases and lists?

Are lists common in database programming or for communicating with databases?

4 Answers

Matthew Hill
Matthew Hill
7,799 Points

There's a separate course for databases in Python. This covers the use of Peewee which is a module designed for database interaction using Python (although there are plenty more available, Django has its own ORM for interacting with databases for example). Could you say how you were anticipating using the list? This might make it easier to answer your question, but these ORMs I've mentioned use classes and method calls to interact with databases, not lists

Alexander Hansson
Alexander Hansson
2,083 Points

Aha. Thank you. Now I understand. I was actually thinking about storing different sets of data in lists and lists of lists like this:

storing in lists -> [1,2,3,4,5] storing in lists of lists -> [[fruit_type,color],[fruit_type,color],[fruit_type,color],[fruit_type,color]]

And I was wondering if that could be used for interacting with databases. But I must admit. My knowledge is very limited at this point in time because I am still just a beginner. But I feel that I am learning at a stunning rate with your courses. Thanks, actually your answer is very sufficient for me for now. :)

Alexander Hansson
Alexander Hansson
2,083 Points

To clarify, I was just guessing but I have to learn more to understand the concepts of databases etc. :) The only thing I need to do right now is to learn and dig in to the basic concepts of programming. :)

Matthew Hill
Matthew Hill
7,799 Points

Sounds like a good way forward! The more I learn the more it all comes together, good luck, Matt

You can also store your data that way using MongoDB. If you want to store it as array that is.