The import pymysql
The class Mysql_Operation:
Def __init__ (self) :
Try:
Self. Conn=pymysql. Connect (
#='localhost' host, IP, the MySQL database server IP address
Port=3306, # port, the default 3306, can not enter
#='root' user, the database user name
Password=root1, # database password
#='ceshibeses' database, to connect the database
The charset='utf8' # character set, not utf-8
)
The self. The cursor=self. Conn. Cursor ()
Except pymysql. Err as e: # as and the except combination, will capture the exception object assigned to e
Print (' haha ')
Ceshi=Mysql_Operation ()
Bosses this is written I connect to the database is currently the password wrong thinking of test errors account password but an error a
catching classes that do not inherit the from BaseException is not allowedthis situation what should I do