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 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.