9951 explained code solutions for 126 technologies


python-mysqlHow do I check the version of my MySQLdb in Python?


To check the version of MySQLdb in Python, you can use the following example code:

import MySQLdb

print(MySQLdb.__version__)

This will output the version of MySQLdb installed in your system, e.g. 1.4.6.

The code consists of the following parts:

  1. import MySQLdb: This imports the MySQLdb module.
  2. print(MySQLdb.__version__): This prints the version of MySQLdb installed in your system.

For more information, please refer to the MySQLdb documentation.

Edit this code on GitHub