Can I Use With Statement With Mysqldb.connection Object?
I wonder if I can use the context manager with with the Connection object, and write code like this: with MySQLdb.connect(...) as conn: do_something() Will the conn object be
Solution 1:
MySQLdb does not support the context manager protocol. Roll your own, or use oursql instead.
Post a Comment for "Can I Use With Statement With Mysqldb.connection Object?"