有一个问题叫做: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/