gpt4 book ai didi

python - clientlibrary.paramstyle 没有正常工作

转载 作者:行者123 更新时间:2023-11-30 21:25:30 24 4
gpt4 key购买 nike

有一个问题叫做:Python best practice and securest to connect to MySQL and execute queries Kirk Strauser 先生说:

You can see which your client library supports by looking at the paramstyle module-level variable:

>>> clientlibrary.paramstyle
'pyformat'

但是当我在我的 python 3 上运行它时,我得到:

>>> clientlibrary.paramstyle
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'clientlibrary' is not defined

我也在pip中搜索过

pip3 search clientlibrary
<nothing>

我能做什么?

最佳答案

paramstyle 是任何 python 数据库模块所必需的(参见 PEP-249 ,clientlibrary 只是您正在使用的 datbase 模块的占位符。

例如

>>> import mysql.connector as clientlibrary
>>> clientlibrary.paramstyle
'pyformat
>>> import mariadb as clientlibrary
>>> clientlibrary.paramstyle
'qmark

关于python - clientlibrary.paramstyle 没有正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59291900/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com