# Make the connection connection = MySQLdb.connect(host='localhost',user='alex',passwd='secret',db='myDB') cursor = connection.cursor() # Lists the tables in demo sql = "SHOW TABLES;" # Execute the SQL query and get the response cursor.execute(sql) response = cursor.fetchall() # Loop through the response and print table names for row in response: print rowFor more examples on how to use MySQLdb in Python, please take a look on Zetcode.com.
Recommended Python Training – DataCamp
For Python training, our top recommendation is DataCamp.
Datacamp provides online interactive courses that combine interactive coding challenges with videos from top instructors in the field.
Datacamp has beginner to advanced Python training that programmers of all levels benefit from.
Read more about: