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