Python MySQLdb:connection.close()与。cursor.close()

Python MySQLdb:connection.close()与。cursor.close(),第1张

Python MySQLdb:connection.close()与。cursor.close()

使用

with
,此工具可让您创建一个临时游标,一旦返回上一个缩进级别,该游标将关闭。

from contextlib import closingwith closing( connection.cursor() ) as cursor:    (indented) use the cursor(non-indented) cursor is closed.connection.close()


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5644617.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-16
下一篇2022-12-16

发表评论

登录后才能评论

评论列表(0条)

    保存