Hello!
I have created a database named Ornithobase, which contains a Users table with Name, FamilyName, eMail and Username columns. I have already connected to the database with MySQLdb module. How can I print this table in the console from the Python script? Furthermore, how can I perform a search based on the Username column and print the results on the console?
Cheers!

Dani

Recommended Answers

All 6 Replies

Thank you jice for your reply. I have already read the tutorial, and I know how to print the data in tuples. However, I would like to print the table in a more user friendly format, something similar as if it was printed directly using MySQL. Is it possible?

Cheers!

Dani

It is just a string formatting... You can use the % operator

Thank you, I'll experiment with it and ask for help if necessary.
Cheers!

Dani

Use pprint, or some tabbed printing, so it looks like a table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.